aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament/mixins
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
committerLinnea Gräf <nea@nea.moe>2025-11-17 19:55:02 +0100
commitc93a04a001b0f66b2724d46b04b6d1ed49a08d07 (patch)
tree5869ca70acc482ef0362f27785c3d3f1cbb9ffae /src/main/java/moe/nea/firmament/mixins
parentaf9893b59407c69d31ebd2ed513f0396ab4d2dc9 (diff)
downloadFirmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.gz
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.tar.bz2
Firmament-c93a04a001b0f66b2724d46b04b6d1ed49a08d07.zip
refactor: port to mojmaps
Diffstat (limited to 'src/main/java/moe/nea/firmament/mixins')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/AppendRepoAsResourcePack.java4
-rw-r--r--src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/CopyChatPatch.java32
-rw-r--r--src/main/java/moe/nea/firmament/mixins/CustomDurabilityBarPatch.java30
-rw-r--r--src/main/java/moe/nea/firmament/mixins/DFUEntityIdFixPatch.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/DisableHurtCam.java4
-rw-r--r--src/main/java/moe/nea/firmament/mixins/DispatchMouseInputEventsPatch.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/EarlyResourceReloadPatch.java14
-rw-r--r--src/main/java/moe/nea/firmament/mixins/EntityDespawnPatch.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/EntityInteractEventPatch.java28
-rw-r--r--src/main/java/moe/nea/firmament/mixins/EntityUpdateEventListener.java48
-rw-r--r--src/main/java/moe/nea/firmament/mixins/FirmKeybindsInVanillaControlsPatch.java32
-rw-r--r--src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java14
-rw-r--r--src/main/java/moe/nea/firmament/mixins/HudRenderEventsPatch.java20
-rw-r--r--src/main/java/moe/nea/firmament/mixins/IncomingPacketListenerPatches.java24
-rw-r--r--src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java12
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MainWindowFirstLoadPatch.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MaintainKeyboardStatePatch.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MinecraftInitLevelListener.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java72
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java14
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MixinRecipeBookScreen.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java12
-rw-r--r--src/main/java/moe/nea/firmament/mixins/OutgoingPacketEventPatch.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java16
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ResourceReloaderRegistrationPatch.java14
-rw-r--r--src/main/java/moe/nea/firmament/mixins/SaveCursorPositionPatch.java24
-rw-r--r--src/main/java/moe/nea/firmament/mixins/SaveOriginalCommandTreePacket.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ScreenChangeEventPatch.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/SlotClickEventPatch.java22
-rw-r--r--src/main/java/moe/nea/firmament/mixins/SlotUpdateListener.java48
-rw-r--r--src/main/java/moe/nea/firmament/mixins/SoundReceiveEventPatch.java22
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ToggleSprintPatch.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/TolerateFirmamentTolerateRegistryOwners.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/WorldReadyEventPatch.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java41
-rw-r--r--src/main/java/moe/nea/firmament/mixins/accessor/AccessorAbstractClientPlayerEntity.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/accessor/AccessorChatHud.java18
-rw-r--r--src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java26
-rw-r--r--src/main/java/moe/nea/firmament/mixins/accessor/AccessorNbtComponent.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/accessor/AccessorPlayerListHud.java20
-rw-r--r--src/main/java/moe/nea/firmament/mixins/accessor/AccessorScreenHandler.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/accessor/AccessorWorldRenderer.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/customgui/OriginalSlotCoords.java2
-rw-r--r--src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java90
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java20
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/EarlyInstantiateTranslations.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java2
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/MixinKeyboard.java10
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java5
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/WarnForUnknownCustomPayloadSends.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/WarnOnMissingTranslations.java14
-rw-r--r--src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java12
-rw-r--r--src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java40
-rw-r--r--src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeStorage.java4
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/ChangeColorOfLivingEntities.java30
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/EntityRenderStateTint.java2
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/InjectIntoRenderState.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/ReplaceOverlayTexture.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableEquipmentRenderer.java26
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableHeadFeatureRenderer.java16
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableItemRenderer.java20
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableSkullBlockEntityRenderer.java16
-rw-r--r--src/main/java/moe/nea/firmament/mixins/render/renderer/MultipleSpecialGuiRenderStates.java24
68 files changed, 575 insertions, 579 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/AppendRepoAsResourcePack.java b/src/main/java/moe/nea/firmament/mixins/AppendRepoAsResourcePack.java
index d8e35d7..30b5020 100644
--- a/src/main/java/moe/nea/firmament/mixins/AppendRepoAsResourcePack.java
+++ b/src/main/java/moe/nea/firmament/mixins/AppendRepoAsResourcePack.java
@@ -7,7 +7,7 @@ import net.fabricmc.fabric.api.resource.ModResourcePack;
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackSorter;
import net.fabricmc.fabric.impl.resource.loader.ModResourcePackUtil;
import net.fabricmc.loader.api.FabricLoader;
-import net.minecraft.resource.ResourceType;
+import net.minecraft.server.packs.PackType;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -25,7 +25,7 @@ public class AppendRepoAsResourcePack {
require = 0
)
private static void onAppendModResourcePack(
- FabricLoader fabricLoader, ResourceType type, @Nullable String subPath, CallbackInfoReturnable<List<ModResourcePack>> cir,
+ FabricLoader fabricLoader, PackType type, @Nullable String subPath, CallbackInfoReturnable<List<ModResourcePack>> cir,
@Local ModResourcePackSorter sorter
) {
RepoModResourcePack.Companion.append(sorter);
diff --git a/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java b/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java
index d898c44..8e591bd 100644
--- a/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/BandAidResourcePackPatch.java
@@ -4,22 +4,22 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.repo.RepoModResourcePack;
-import net.minecraft.resource.ReloadableResourceManagerImpl;
-import net.minecraft.resource.Resource;
-import net.minecraft.util.Identifier;
+import net.minecraft.server.packs.resources.ReloadableResourceManager;
+import net.minecraft.server.packs.resources.Resource;
+import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import java.util.Optional;
-@Mixin(ReloadableResourceManagerImpl.class)
+@Mixin(ReloadableResourceManager.class)
public class BandAidResourcePackPatch {
@ModifyReturnValue(
method = "getResource",
at = @At("RETURN")
)
- private Optional<Resource> injectOurCustomResourcesInCaseExistingMethodsFailed(Optional<Resource> original, @Local Identifier identifier) {
+ private Optional<Resource> injectOurCustomResourcesInCaseExistingMethodsFailed(Optional<Resource> original, @Local ResourceLocation identifier) {
return original.or(() -> RepoModResourcePack.Companion.createResourceDirectly(identifier));
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java b/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
index 9f6fb4d..2bc1374 100644
--- a/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
@@ -4,12 +4,12 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import moe.nea.firmament.features.fixes.Fixes;
-import net.minecraft.client.gui.hud.ChatHud;
+import net.minecraft.client.gui.components.ChatComponent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
-@Mixin(ChatHud.class)
+@Mixin(ChatComponent.class)
public class ChatPeekingPatch {
@ModifyVariable(method = "render", at = @At(value = "HEAD"), index = 5, argsOnly = true)
@@ -17,7 +17,7 @@ public class ChatPeekingPatch {
return old || Fixes.INSTANCE.shouldPeekChat();
}
- @ModifyExpressionValue(method = "getHeight()I", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z"))
+ @ModifyExpressionValue(method = "getHeight()I", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/ChatComponent;isChatFocused()Z"))
public boolean onGetChatHudHeight(boolean old) {
return old || Fixes.INSTANCE.shouldPeekChat();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/CopyChatPatch.java b/src/main/java/moe/nea/firmament/mixins/CopyChatPatch.java
index ba337da..9079fc9 100644
--- a/src/main/java/moe/nea/firmament/mixins/CopyChatPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/CopyChatPatch.java
@@ -3,14 +3,14 @@ package moe.nea.firmament.mixins;
import moe.nea.firmament.features.chat.CopyChat;
import moe.nea.firmament.mixins.accessor.AccessorChatHud;
import moe.nea.firmament.util.ClipboardUtils;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.Click;
-import net.minecraft.client.gui.hud.ChatHud;
-import net.minecraft.client.gui.hud.ChatHudLine;
-import net.minecraft.client.gui.screen.ChatScreen;
-import net.minecraft.text.Text;
-import net.minecraft.util.Formatting;
-import net.minecraft.util.math.MathHelper;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.input.MouseButtonEvent;
+import net.minecraft.client.gui.components.ChatComponent;
+import net.minecraft.client.GuiMessage;
+import net.minecraft.client.gui.screens.ChatScreen;
+import net.minecraft.network.chat.Component;
+import net.minecraft.ChatFormatting;
+import net.minecraft.util.Mth;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -21,25 +21,25 @@ import java.util.List;
@Mixin(ChatScreen.class)
public class CopyChatPatch {
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
- private void onRightClick(Click click, boolean doubled, CallbackInfoReturnable<Boolean> cir) throws NoSuchFieldException, IllegalAccessException {
+ private void onRightClick(MouseButtonEvent click, boolean doubled, CallbackInfoReturnable<Boolean> cir) throws NoSuchFieldException, IllegalAccessException {
if (click.button() != 1 || !CopyChat.TConfig.INSTANCE.getCopyChat()) return;
- MinecraftClient client = MinecraftClient.getInstance();
- ChatHud chatHud = client.inGameHud.getChatHud();
+ Minecraft client = Minecraft.getInstance();
+ ChatComponent chatHud = client.gui.getChat();
int lineIndex = getChatLineIndex(chatHud, click.y());
if (lineIndex < 0) return;
- List<ChatHudLine.Visible> visible = ((AccessorChatHud) chatHud).getVisibleMessages_firmament();
+ List<GuiMessage.Line> visible = ((AccessorChatHud) chatHud).getVisibleMessages_firmament();
if (lineIndex >= visible.size()) return;
- ChatHudLine.Visible line = visible.get(lineIndex);
+ GuiMessage.Line line = visible.get(lineIndex);
String text = CopyChat.INSTANCE.orderedTextToString(line.content());
ClipboardUtils.INSTANCE.setTextContent(text);
- chatHud.addMessage(Text.literal("Copied: ").append(text).formatted(Formatting.GRAY));
+ chatHud.addMessage(Component.literal("Copied: ").append(text).withStyle(ChatFormatting.GRAY));
cir.setReturnValue(true);
cir.cancel();
}
@Unique
- private int getChatLineIndex(ChatHud chatHud, double mouseY) {
+ private int getChatLineIndex(ChatComponent chatHud, double mouseY) {
double chatLineY = ((AccessorChatHud) chatHud).toChatLineY_firmament(mouseY);
- return MathHelper.floor(chatLineY + ((AccessorChatHud) chatHud).getScrolledLines_firmament());
+ return Mth.floor(chatLineY + ((AccessorChatHud) chatHud).getScrolledLines_firmament());
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/CustomDurabilityBarPatch.java b/src/main/java/moe/nea/firmament/mixins/CustomDurabilityBarPatch.java
index fde3580..2299068 100644
--- a/src/main/java/moe/nea/firmament/mixins/CustomDurabilityBarPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/CustomDurabilityBarPatch.java
@@ -6,20 +6,20 @@ import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import moe.nea.firmament.util.DurabilityBarEvent;
-import net.minecraft.client.gui.DrawContext;
-import net.minecraft.item.ItemStack;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-@Mixin(DrawContext.class)
+@Mixin(GuiGraphics.class)
public class CustomDurabilityBarPatch {
@WrapOperation(
- method = "drawItemBar",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;isItemBarVisible()Z")
+ method = "renderItemBar",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;isBarVisible()Z")
)
private boolean onIsItemBarVisible(
- ItemStack instance, Operation<Boolean> original,
- @Share("barOverride") LocalRef<DurabilityBarEvent.DurabilityBar> barOverride
+ ItemStack instance, Operation<Boolean> original,
+ @Share("barOverride") LocalRef<DurabilityBarEvent.DurabilityBar> barOverride
) {
if (original.call(instance))
return true;
@@ -29,22 +29,22 @@ public class CustomDurabilityBarPatch {
return barOverride.get() != null;
}
- @WrapOperation(method = "drawItemBar",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItemBarStep()I"))
+ @WrapOperation(method = "renderItemBar",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;getBarWidth()I"))
private int overrideItemStep(
- ItemStack instance, Operation<Integer> original,
- @Share("barOverride") LocalRef<DurabilityBarEvent.DurabilityBar> barOverride
+ ItemStack instance, Operation<Integer> original,
+ @Share("barOverride") LocalRef<DurabilityBarEvent.DurabilityBar> barOverride
) {
if (barOverride.get() != null)
return Math.round(barOverride.get().getPercentage() * 13);
return original.call(instance);
}
- @WrapOperation(method = "drawItemBar",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItemBarColor()I"))
+ @WrapOperation(method = "renderItemBar",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/world/item/ItemStack;getBarColor()I"))
private int overrideItemColor(
- ItemStack instance, Operation<Integer> original,
- @Share("barOverride") LocalRef<DurabilityBarEvent.DurabilityBar> barOverride
+ ItemStack instance, Operation<Integer> original,
+ @Share("barOverride") LocalRef<DurabilityBarEvent.DurabilityBar> barOverride
) {
if (barOverride.get() != null)
return barOverride.get().getColor().getColor();
diff --git a/src/main/java/moe/nea/firmament/mixins/DFUEntityIdFixPatch.java b/src/main/java/moe/nea/firmament/mixins/DFUEntityIdFixPatch.java
index 717d404..8503411 100644
--- a/src/main/java/moe/nea/firmament/mixins/DFUEntityIdFixPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/DFUEntityIdFixPatch.java
@@ -6,8 +6,8 @@ import com.mojang.datafixers.DataFix;
import com.mojang.datafixers.TypeRewriteRule;
import com.mojang.datafixers.schemas.Schema;
import com.mojang.datafixers.util.Pair;
-import net.minecraft.datafixer.TypeReferences;
-import net.minecraft.datafixer.fix.EntityIdFix;
+import net.minecraft.util.datafix.fixes.References;
+import net.minecraft.util.datafix.fixes.EntityIdFix;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -22,7 +22,7 @@ import java.util.Map;
public abstract class DFUEntityIdFixPatch extends DataFix {
@Shadow
@Final
- private static Map<String, String> RENAMED_ENTITIES;
+ private static Map<String, String> ID_MAP;
public DFUEntityIdFixPatch(Schema outputSchema, boolean changesType) {
super(outputSchema, changesType);
@@ -30,6 +30,6 @@ public abstract class DFUEntityIdFixPatch extends DataFix {
@Inject(method = "makeRule", at = @At("RETURN"), cancellable = true)
public void onMakeRule(CallbackInfoReturnable<TypeRewriteRule> cir) {
- cir.setReturnValue(TypeRewriteRule.seq(fixTypeEverywhere("EntityIdFix", getInputSchema().findChoiceType(TypeReferences.ENTITY), getOutputSchema().findChoiceType(TypeReferences.ENTITY), dynamicOps -> pair -> ((Pair) pair).mapFirst(string -> RENAMED_ENTITIES.getOrDefault(string, (String) string))), convertUnchecked("Fix Type", getInputSchema().getType(TypeReferences.ITEM_STACK), getOutputSchema().getType(TypeReferences.ITEM_STACK))));
+ cir.setReturnValue(TypeRewriteRule.seq(fixTypeEverywhere("EntityIdFix", getInputSchema().findChoiceType(References.ENTITY), getOutputSchema().findChoiceType(References.ENTITY), dynamicOps -> pair -> ((Pair) pair).mapFirst(string -> ID_MAP.getOrDefault(string, (String) string))), convertUnchecked("Fix Type", getInputSchema().getType(References.ITEM_STACK), getOutputSchema().getType(References.ITEM_STACK))));
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/DisableHurtCam.java b/src/main/java/moe/nea/firmament/mixins/DisableHurtCam.java
index ed7a2d4..3a53ab1 100644
--- a/src/main/java/moe/nea/firmament/mixins/DisableHurtCam.java
+++ b/src/main/java/moe/nea/firmament/mixins/DisableHurtCam.java
@@ -2,14 +2,14 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import moe.nea.firmament.features.fixes.Fixes;
-import net.minecraft.client.render.GameRenderer;
+import net.minecraft.client.renderer.GameRenderer;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@Mixin(GameRenderer.class)
public class DisableHurtCam {
- @ModifyExpressionValue(method = "tiltViewWhenHurt", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/LivingEntity;hurtTime:I", opcode = Opcodes.GETFIELD))
+ @ModifyExpressionValue(method = "bobHurt", at = @At(value = "FIELD", target = "Lnet/minecraft/world/entity/LivingEntity;hurtTime:I", opcode = Opcodes.GETFIELD))
private int replaceHurtTime(int original) {
if (Fixes.TConfig.INSTANCE.getNoHurtCam())
return 0;
diff --git a/src/main/java/moe/nea/firmament/mixins/DispatchMouseInputEventsPatch.java b/src/main/java/moe/nea/firmament/mixins/DispatchMouseInputEventsPatch.java
index f1b07bb..8b9a28c 100644
--- a/src/main/java/moe/nea/firmament/mixins/DispatchMouseInputEventsPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/DispatchMouseInputEventsPatch.java
@@ -2,15 +2,15 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import moe.nea.firmament.events.WorldMouseMoveEvent;
-import net.minecraft.client.Mouse;
-import net.minecraft.client.network.ClientPlayerEntity;
+import net.minecraft.client.MouseHandler;
+import net.minecraft.client.player.LocalPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-@Mixin(Mouse.class)
+@Mixin(MouseHandler.class)
public class DispatchMouseInputEventsPatch {
- @WrapWithCondition(method = "updateMouse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;changeLookDirection(DD)V"))
- public boolean onRotatePlayer(ClientPlayerEntity instance, double deltaX, double deltaY) {
+ @WrapWithCondition(method = "turnPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/player/LocalPlayer;changeLookDirection(DD)V"))
+ public boolean onRotatePlayer(LocalPlayer instance, double deltaX, double deltaY) {
var event = WorldMouseMoveEvent.Companion.publish(new WorldMouseMoveEvent(deltaX, deltaY));
return !event.getCancelled();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/EarlyResourceReloadPatch.java b/src/main/java/moe/nea/firmament/mixins/EarlyResourceReloadPatch.java
index e98faf6..b8460a7 100644
--- a/src/main/java/moe/nea/firmament/mixins/EarlyResourceReloadPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/EarlyResourceReloadPatch.java
@@ -2,10 +2,10 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.events.EarlyResourceReloadEvent;
-import net.minecraft.resource.ReloadableResourceManagerImpl;
-import net.minecraft.resource.ResourceManager;
-import net.minecraft.resource.ResourcePack;
-import net.minecraft.resource.ResourceReload;
+import net.minecraft.server.packs.resources.ReloadableResourceManager;
+import net.minecraft.server.packs.resources.ResourceManager;
+import net.minecraft.server.packs.PackResources;
+import net.minecraft.server.packs.resources.ReloadInstance;
import net.minecraft.util.Unit;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -16,10 +16,10 @@ import java.util.List;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor;
-@Mixin(ReloadableResourceManagerImpl.class)
+@Mixin(ReloadableResourceManager.class)
public abstract class EarlyResourceReloadPatch implements ResourceManager {
- @Inject(method = "reload", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/SimpleResourceReload;start(Lnet/minecraft/resource/ResourceManager;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Z)Lnet/minecraft/resource/ResourceReload;", shift = At.Shift.BEFORE))
- public void onResourceReload(Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage, List<ResourcePack> packs, CallbackInfoReturnable<ResourceReload> cir) {
+ @Inject(method = "createReload", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/resources/SimpleReloadInstance;create(Lnet/minecraft/server/packs/resources/ResourceManager;Ljava/util/List;Ljava/util/concurrent/Executor;Ljava/util/concurrent/Executor;Ljava/util/concurrent/CompletableFuture;Z)Lnet/minecraft/server/packs/resources/ReloadInstance;", shift = At.Shift.BEFORE))
+ public void onResourceReload(Executor prepareExecutor, Executor applyExecutor, CompletableFuture<Unit> initialStage, List<PackResources> packs, CallbackInfoReturnable<ReloadInstance> cir) {
EarlyResourceReloadEvent.Companion.publish(new EarlyResourceReloadEvent(this, prepareExecutor));
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/EntityDespawnPatch.java b/src/main/java/moe/nea/firmament/mixins/EntityDespawnPatch.java
index 22bebec..c286226 100644
--- a/src/main/java/moe/nea/firmament/mixins/EntityDespawnPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/EntityDespawnPatch.java
@@ -3,15 +3,15 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.events.EntityDespawnEvent;
-import net.minecraft.client.world.ClientWorld;
-import net.minecraft.entity.Entity;
+import net.minecraft.client.multiplayer.ClientLevel;
+import net.minecraft.world.entity.Entity;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ClientWorld.class)
+@Mixin(ClientLevel.class)
public class EntityDespawnPatch {
@Inject(method = "removeEntity", at = @At(value = "TAIL"))
private void onRemoved(int entityId, Entity.RemovalReason removalReason, CallbackInfo ci, @Local @Nullable Entity entity) {
diff --git a/src/main/java/moe/nea/firmament/mixins/EntityInteractEventPatch.java b/src/main/java/moe/nea/firmament/mixins/EntityInteractEventPatch.java
index 8ade59b..4138389 100644
--- a/src/main/java/moe/nea/firmament/mixins/EntityInteractEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/EntityInteractEventPatch.java
@@ -2,32 +2,32 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.events.EntityInteractionEvent;
-import net.minecraft.client.network.ClientPlayerInteractionManager;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.util.ActionResult;
-import net.minecraft.util.Hand;
-import net.minecraft.util.hit.EntityHitResult;
+import net.minecraft.client.multiplayer.MultiPlayerGameMode;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.InteractionResult;
+import net.minecraft.world.InteractionHand;
+import net.minecraft.world.phys.EntityHitResult;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(ClientPlayerInteractionManager.class)
+@Mixin(MultiPlayerGameMode.class)
public class EntityInteractEventPatch {
- @Inject(method = "attackEntity", at = @At("HEAD"))
- private void onAttack(PlayerEntity player, Entity target, CallbackInfo ci) {
- EntityInteractionEvent.Companion.publish(new EntityInteractionEvent(EntityInteractionEvent.InteractionKind.ATTACK, target, Hand.MAIN_HAND));
+ @Inject(method = "attack", at = @At("HEAD"))
+ private void onAttack(Player player, Entity target, CallbackInfo ci) {
+ EntityInteractionEvent.Companion.publish(new EntityInteractionEvent(EntityInteractionEvent.InteractionKind.ATTACK, target, InteractionHand.MAIN_HAND));
}
- @Inject(method = "interactEntity", at = @At("HEAD"))
- private void onInteract(PlayerEntity player, Entity entity, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
+ @Inject(method = "interact", at = @At("HEAD"))
+ private void onInteract(Player player, Entity entity, InteractionHand hand, CallbackInfoReturnable<InteractionResult> cir) {
EntityInteractionEvent.Companion.publish(new EntityInteractionEvent(EntityInteractionEvent.InteractionKind.INTERACT, entity, hand));
}
- @Inject(method = "interactEntityAtLocation", at = @At("HEAD"))
- private void onInteractAtLocation(PlayerEntity player, Entity entity, EntityHitResult hitResult, Hand hand, CallbackInfoReturnable<ActionResult> cir) {
+ @Inject(method = "interactAt", at = @At("HEAD"))
+ private void onInteractAtLocation(Player player, Entity entity, EntityHitResult hitResult, InteractionHand hand, CallbackInfoReturnable<InteractionResult> cir) {
EntityInteractionEvent.Companion.publish(new EntityInteractionEvent(EntityInteractionEvent.InteractionKind.INTERACT_AT_LOCATION, entity, hand));
}
diff --git a/src/main/java/moe/nea/firmament/mixins/EntityUpdateEventListener.java b/src/main/java/moe/nea/firmament/mixins/EntityUpdateEventListener.java
index d956da9..0021099 100644
--- a/src/main/java/moe/nea/firmament/mixins/EntityUpdateEventListener.java
+++ b/src/main/java/moe/nea/firmament/mixins/EntityUpdateEventListener.java
@@ -3,46 +3,46 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.events.EntityUpdateEvent;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.network.ClientCommonNetworkHandler;
-import net.minecraft.client.network.ClientConnectionState;
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.client.world.ClientWorld;
-import net.minecraft.entity.Entity;
-import net.minecraft.entity.LivingEntity;
-import net.minecraft.network.ClientConnection;
-import net.minecraft.network.packet.s2c.play.EntityAttributesS2CPacket;
-import net.minecraft.network.packet.s2c.play.EntityEquipmentUpdateS2CPacket;
-import net.minecraft.network.packet.s2c.play.EntityTrackerUpdateS2CPacket;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
+import net.minecraft.client.multiplayer.CommonListenerCookie;
+import net.minecraft.client.multiplayer.ClientPacketListener;
+import net.minecraft.client.multiplayer.ClientLevel;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.world.entity.LivingEntity;
+import net.minecraft.network.Connection;
+import net.minecraft.network.protocol.game.ClientboundUpdateAttributesPacket;
+import net.minecraft.network.protocol.game.ClientboundSetEquipmentPacket;
+import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ClientPlayNetworkHandler.class)
-public abstract class EntityUpdateEventListener extends ClientCommonNetworkHandler {
+@Mixin(ClientPacketListener.class)
+public abstract class EntityUpdateEventListener extends ClientCommonPacketListenerImpl {
@Shadow
- private ClientWorld world;
+ private ClientLevel level;
- protected EntityUpdateEventListener(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) {
+ protected EntityUpdateEventListener(Minecraft client, Connection connection, CommonListenerCookie connectionState) {
super(client, connection, connectionState);
}
- @Inject(method = "onEntityEquipmentUpdate", at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", shift = At.Shift.AFTER))
- private void onEquipmentUpdate(EntityEquipmentUpdateS2CPacket packet, CallbackInfo ci, @Local LivingEntity entity) {
- EntityUpdateEvent.Companion.publish(new EntityUpdateEvent.EquipmentUpdate(entity, packet.getEquipmentList()));
+ @Inject(method = "handleSetEquipment", at = @At(value = "INVOKE", target = "Ljava/util/List;forEach(Ljava/util/function/Consumer;)V", shift = At.Shift.AFTER))
+ private void onEquipmentUpdate(ClientboundSetEquipmentPacket packet, CallbackInfo ci, @Local LivingEntity entity) {
+ EntityUpdateEvent.Companion.publish(new EntityUpdateEvent.EquipmentUpdate(entity, packet.getSlots()));
}
- @Inject(method = "onEntityAttributes", at = @At("TAIL"))
- private void onAttributeUpdate(EntityAttributesS2CPacket packet, CallbackInfo ci) {
+ @Inject(method = "handleUpdateAttributes", at = @At("TAIL"))
+ private void onAttributeUpdate(ClientboundUpdateAttributesPacket packet, CallbackInfo ci) {
EntityUpdateEvent.Companion.publish(new EntityUpdateEvent.AttributeUpdate(
- (LivingEntity) world.getEntityById(packet.getEntityId()), packet.getEntries()));
+ (LivingEntity) level.getEntity(packet.getEntityId()), packet.getValues()));
}
- @Inject(method = "onEntityTrackerUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/data/DataTracker;writeUpdatedEntries(Ljava/util/List;)V", shift = At.Shift.AFTER))
- private void onEntityTracker(EntityTrackerUpdateS2CPacket packet, CallbackInfo ci, @Local Entity entity) {
- EntityUpdateEvent.Companion.publish(new EntityUpdateEvent.TrackedDataUpdate(entity, packet.trackedValues()));
+ @Inject(method = "handleSetEntityData", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/syncher/SynchedEntityData;assignValues(Ljava/util/List;)V", shift = At.Shift.AFTER))
+ private void onEntityTracker(ClientboundSetEntityDataPacket packet, CallbackInfo ci, @Local Entity entity) {
+ EntityUpdateEvent.Companion.publish(new EntityUpdateEvent.TrackedDataUpdate(entity, packet.packedItems()));
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/FirmKeybindsInVanillaControlsPatch.java b/src/main/java/moe/nea/firmament/mixins/FirmKeybindsInVanillaControlsPatch.java
index 4c9f925..5d8484f 100644
--- a/src/main/java/moe/nea/firmament/mixins/FirmKeybindsInVanillaControlsPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/FirmKeybindsInVanillaControlsPatch.java
@@ -4,11 +4,11 @@ package moe.nea.firmament.mixins;
import moe.nea.firmament.gui.config.KeyBindingHandler;
import moe.nea.firmament.keybindings.FirmamentKeyBindings;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.option.ControlsListWidget;
-import net.minecraft.client.gui.widget.ButtonWidget;
-import net.minecraft.client.option.KeyBinding;
-import net.minecraft.text.Text;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.screens.options.controls.KeyBindsList;
+import net.minecraft.client.gui.components.Button;
+import net.minecraft.client.KeyMapping;
+import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Mutable;
@@ -18,39 +18,39 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ControlsListWidget.KeyBindingEntry.class)
+@Mixin(KeyBindsList.KeyEntry.class)
public class FirmKeybindsInVanillaControlsPatch {
@Mutable
@Shadow
@Final
- private ButtonWidget editButton;
+ private Button changeButton;
@Shadow
@Final
- private KeyBinding binding;
+ private KeyMapping key;
@Shadow
@Final
- private ButtonWidget resetButton;
+ private Button resetButton;
- @ModifyArg(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/widget/ButtonWidget;builder(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/ButtonWidget$PressAction;)Lnet/minecraft/client/gui/widget/ButtonWidget$Builder;"))
- public ButtonWidget.PressAction onInit(ButtonWidget.PressAction action) {
- var config = FirmamentKeyBindings.INSTANCE.getKeyBindings().get(binding);
+ @ModifyArg(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/components/Button;builder(Lnet/minecraft/network/chat/Component;Lnet/minecraft/client/gui/components/Button$OnPress;)Lnet/minecraft/client/gui/components/Button$Builder;"))
+ public Button.OnPress onInit(Button.OnPress action) {
+ var config = FirmamentKeyBindings.INSTANCE.getKeyBindings().get(key);
if (config == null) return action;
return button -> {
((KeyBindingHandler) config.getHandler())
.getManagedConfig()
- .showConfigEditor(MinecraftClient.getInstance().currentScreen);
+ .showConfigEditor(Minecraft.getInstance().screen);
};
}
- @Inject(method = "update", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "refreshEntry", at = @At("HEAD"), cancellable = true)
public void onUpdate(CallbackInfo ci) {
- var config = FirmamentKeyBindings.INSTANCE.getKeyBindings().get(binding);
+ var config = FirmamentKeyBindings.INSTANCE.getKeyBindings().get(key);
if (config == null) return;
resetButton.active = false;
- editButton.setMessage(Text.translatable("firmament.keybinding.external", config.getValue().format()));
+ changeButton.setMessage(Component.translatable("firmament.keybinding.external", config.getValue().format()));
ci.cancel();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java b/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java
index 58f52f4..b2884cd 100644
--- a/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/HideStatusEffectsPatch.java
@@ -2,8 +2,8 @@ package moe.nea.firmament.mixins;
import moe.nea.firmament.features.fixes.Fixes;
import moe.nea.firmament.util.SBData;
-import net.minecraft.client.gui.DrawContext;
-import net.minecraft.client.gui.screen.ingame.StatusEffectsDisplay;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraft.client.gui.screens.inventory.EffectsInInventory;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -11,20 +11,20 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(StatusEffectsDisplay.class)
+@Mixin(EffectsInInventory.class)
public abstract class HideStatusEffectsPatch {
@Shadow
- public abstract boolean shouldHideStatusEffectHud();
+ public abstract boolean canSeeEffects();
- @Inject(method = "shouldHideStatusEffectHud", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "canSeeEffects", at = @At("HEAD"), cancellable = true)
private void hideStatusEffects(CallbackInfoReturnable<Boolean> cir) {
if (Fixes.TConfig.INSTANCE.getHidePotionEffects()) {
cir.setReturnValue(false);
}
}
- @Inject(method = "drawStatusEffects", at = @At("HEAD"), cancellable = true)
- private void conditionalRenderStatuses(DrawContext context, int mouseX, int mouseY, CallbackInfo ci) {
+ @Inject(method = "renderEffects", at = @At("HEAD"), cancellable = true)
+ private void conditionalRenderStatuses(GuiGraphics context, int mouseX, int mouseY, CallbackInfo ci) {
if (Fixes.TConfig.INSTANCE.getHidePotionEffects()) {
ci.cancel();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/HudRenderEventsPatch.java b/src/main/java/moe/nea/firmament/mixins/HudRenderEventsPatch.java
index 3ec5a0e..1f7e07a 100644
--- a/src/main/java/moe/nea/firmament/mixins/HudRenderEventsPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/HudRenderEventsPatch.java
@@ -6,30 +6,30 @@ import moe.nea.firmament.events.HotbarItemRenderEvent;
import moe.nea.firmament.events.HudRenderEvent;
import moe.nea.firmament.features.fixes.Fixes;
import moe.nea.firmament.util.SBData;
-import net.minecraft.client.gui.DrawContext;
-import net.minecraft.client.gui.hud.InGameHud;
-import net.minecraft.client.render.RenderTickCounter;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.ItemStack;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.DeltaTracker;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.ItemStack;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(InGameHud.class)
+@Mixin(Gui.class)
public class HudRenderEventsPatch {
@Inject(method = "renderSleepOverlay", at = @At(value = "HEAD"))
- public void renderCallBack(DrawContext context, RenderTickCounter tickCounter, CallbackInfo ci) {
+ public void renderCallBack(GuiGraphics context, DeltaTracker tickCounter, CallbackInfo ci) {
HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickCounter));
}
- @Inject(method = "renderHotbarItem", at = @At("HEAD"))
- public void onRenderHotbarItem(DrawContext context, int x, int y, RenderTickCounter tickCounter, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
+ @Inject(method = "renderSlot", at = @At("HEAD"))
+ public void onRenderHotbarItem(GuiGraphics context, int x, int y, DeltaTracker tickCounter, Player player, ItemStack stack, int seed, CallbackInfo ci) {
if (stack != null && !stack.isEmpty())
HotbarItemRenderEvent.Companion.publish(new HotbarItemRenderEvent(stack, context, x, y, tickCounter));
}
- @Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "renderEffects", at = @At("HEAD"), cancellable = true)
public void hideStatusEffects(CallbackInfo ci) {
if (Fixes.TConfig.INSTANCE.getHidePotionEffectsHud() && SBData.INSTANCE.isOnSkyblock()) ci.cancel();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/IncomingPacketListenerPatches.java b/src/main/java/moe/nea/firmament/mixins/IncomingPacketListenerPatches.java
index 5ba38c7..9f338f5 100644
--- a/src/main/java/moe/nea/firmament/mixins/IncomingPacketListenerPatches.java
+++ b/src/main/java/moe/nea/firmament/mixins/IncomingPacketListenerPatches.java
@@ -6,33 +6,33 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.mojang.brigadier.CommandDispatcher;
import moe.nea.firmament.events.MaskCommands;
import moe.nea.firmament.events.ParticleSpawnEvent;
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.network.packet.s2c.play.ParticleS2CPacket;
-import net.minecraft.util.math.Vec3d;
+import net.minecraft.client.multiplayer.ClientPacketListener;
+import net.minecraft.network.protocol.game.ClientboundLevelParticlesPacket;
+import net.minecraft.world.phys.Vec3;
import org.joml.Vector3f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ClientPlayNetworkHandler.class)
+@Mixin(ClientPacketListener.class)
public abstract class IncomingPacketListenerPatches {
- @ModifyExpressionValue(method = "onCommandTree", at = @At(value = "NEW", target = "(Lcom/mojang/brigadier/tree/RootCommandNode;)Lcom/mojang/brigadier/CommandDispatcher;", remap = false))
+ @ModifyExpressionValue(method = "handleCommands", at = @At(value = "NEW", target = "(Lcom/mojang/brigadier/tree/RootCommandNode;)Lcom/mojang/brigadier/CommandDispatcher;", remap = false))
public CommandDispatcher onOnCommandTree(CommandDispatcher dispatcher) {
MaskCommands.Companion.publish(new MaskCommands(dispatcher));
return dispatcher;
}
- @Inject(method = "onParticle", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/NetworkThreadUtils;forceMainThread(Lnet/minecraft/network/packet/Packet;Lnet/minecraft/network/listener/PacketListener;Lnet/minecraft/network/PacketApplyBatcher;)V", shift = At.Shift.AFTER), cancellable = true)
- public void onParticleSpawn(ParticleS2CPacket packet, CallbackInfo ci) {
+ @Inject(method = "handleParticleEvent", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/protocol/PacketUtils;ensureRunningOnSameThread(Lnet/minecraft/network/protocol/Packet;Lnet/minecraft/network/PacketListener;Lnet/minecraft/network/PacketProcessor;)V", shift = At.Shift.AFTER), cancellable = true)
+ public void onParticleSpawn(ClientboundLevelParticlesPacket packet, CallbackInfo ci) {
var event = new ParticleSpawnEvent(
- packet.getParameters(),
- new Vec3d(packet.getX(), packet.getY(), packet.getZ()),
- new Vector3f(packet.getOffsetX(), packet.getOffsetY(), packet.getOffsetZ()),
- packet.isImportant(),
+ packet.getParticle(),
+ new Vec3(packet.getX(), packet.getY(), packet.getZ()),
+ new Vector3f(packet.getXDist(), packet.getYDist(), packet.getZDist()),
+ packet.alwaysShow(),
packet.getCount(),
- packet.getSpeed()
+ packet.getMaxSpeed()
);
ParticleSpawnEvent.Companion.publish(event);
if (event.getCancelled())
diff --git a/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java b/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java
index 836aee8..ee7f570 100644
--- a/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/KeyPressInWorldEventPatch.java
@@ -7,17 +7,17 @@ import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.events.WorldKeyboardEvent;
import moe.nea.firmament.keybindings.GenericInputAction;
import moe.nea.firmament.keybindings.InputModifiers;
-import net.minecraft.client.Keyboard;
-import net.minecraft.client.input.KeyInput;
-import net.minecraft.client.util.InputUtil;
+import net.minecraft.client.KeyboardHandler;
+import net.minecraft.client.input.KeyEvent;
+import com.mojang.blaze3d.platform.InputConstants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-@Mixin(Keyboard.class)
+@Mixin(KeyboardHandler.class)
public class KeyPressInWorldEventPatch {
- @WrapWithCondition(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V"))
- public boolean onKeyBoardInWorld(InputUtil.Key key, @Local(argsOnly = true) KeyInput keyInput) {
+ @WrapWithCondition(method = "keyPress", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyMapping;click(Lcom/mojang/blaze3d/platform/InputConstants$Key;)V"))
+ public boolean onKeyBoardInWorld(InputConstants.Key key, @Local(argsOnly = true) KeyEvent keyInput) {
var event = WorldKeyboardEvent.Companion.publish(new WorldKeyboardEvent(GenericInputAction.of(keyInput), InputModifiers.of(keyInput)));
return !event.getCancelled();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MainWindowFirstLoadPatch.java b/src/main/java/moe/nea/firmament/mixins/MainWindowFirstLoadPatch.java
index 9e42b20..2f82fd9 100644
--- a/src/main/java/moe/nea/firmament/mixins/MainWindowFirstLoadPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/MainWindowFirstLoadPatch.java
@@ -2,8 +2,8 @@ package moe.nea.firmament.mixins;
import moe.nea.firmament.Firmament;
import moe.nea.firmament.events.DebugInstantiateEvent;
-import net.minecraft.client.gui.LogoDrawer;
-import net.minecraft.client.gui.screen.TitleScreen;
+import net.minecraft.client.gui.components.LogoRenderer;
+import net.minecraft.client.gui.screens.TitleScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
@@ -15,8 +15,8 @@ public class MainWindowFirstLoadPatch {
@Unique
private static boolean hasInited = false;
- @Inject(method = "<init>(ZLnet/minecraft/client/gui/LogoDrawer;)V", at = @At("RETURN"))
- private void onCreate(boolean doBackgroundFade, LogoDrawer logoDrawer, CallbackInfo ci) {
+ @Inject(method = "<init>(ZLnet/minecraft/client/gui/components/LogoRenderer;)V", at = @At("RETURN"))
+ private void onCreate(boolean doBackgroundFade, LogoRenderer logoDrawer, CallbackInfo ci) {
if (!hasInited && Firmament.INSTANCE.getDEBUG()) {
try {
DebugInstantiateEvent.Companion.publish(new DebugInstantiateEvent());
diff --git a/src/main/java/moe/nea/firmament/mixins/MaintainKeyboardStatePatch.java b/src/main/java/moe/nea/firmament/mixins/MaintainKeyboardStatePatch.java
index 15fc5df..97d524a 100644
--- a/src/main/java/moe/nea/firmament/mixins/MaintainKeyboardStatePatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/MaintainKeyboardStatePatch.java
@@ -1,17 +1,17 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.keybindings.FirmamentKeyboardState;
-import net.minecraft.client.Keyboard;
-import net.minecraft.client.input.KeyInput;
+import net.minecraft.client.KeyboardHandler;
+import net.minecraft.client.input.KeyEvent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(Keyboard.class)
+@Mixin(KeyboardHandler.class)
public class MaintainKeyboardStatePatch {
- @Inject(method = "onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/InactivityFpsLimiter;onInput()V"))
- private void onKeyInput(long window, int action, KeyInput input, CallbackInfo ci) {
+ @Inject(method = "keyPress", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/FramerateLimitTracker;onInputReceived()V"))
+ private void onKeyInput(long window, int action, KeyEvent input, CallbackInfo ci) {
FirmamentKeyboardState.INSTANCE.maintainState(input, action);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MinecraftInitLevelListener.java b/src/main/java/moe/nea/firmament/mixins/MinecraftInitLevelListener.java
index 1673987..7c1189b 100644
--- a/src/main/java/moe/nea/firmament/mixins/MinecraftInitLevelListener.java
+++ b/src/main/java/moe/nea/firmament/mixins/MinecraftInitLevelListener.java
@@ -1,15 +1,15 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.util.mc.InitLevel;
-import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(MinecraftClient.class)
+@Mixin(Minecraft.class)
public class MinecraftInitLevelListener {
- @Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;initBackendSystem()Lnet/minecraft/util/TimeSupplier$Nanoseconds;"))
+ @Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;initBackendSystem()Lnet/minecraft/util/TimeSource$NanoTimeSource;"))
private void onInitRenderBackend(CallbackInfo ci) {
InitLevel.bump(InitLevel.RENDER_INIT);
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
index 409fb6b..bd2b594 100644
--- a/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/MixinHandledScreen.java
@@ -8,16 +8,16 @@ import moe.nea.firmament.events.*;
import moe.nea.firmament.events.HandledScreenClickEvent;
import moe.nea.firmament.keybindings.GenericInputAction;
import moe.nea.firmament.keybindings.InputModifiers;
-import net.minecraft.client.gui.Click;
-import net.minecraft.client.gui.DrawContext;
-import net.minecraft.client.gui.screen.ingame.HandledScreen;
-import net.minecraft.client.input.KeyInput;
-import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.item.ItemStack;
-import net.minecraft.screen.ScreenHandler;
-import net.minecraft.screen.slot.Slot;
-import net.minecraft.screen.slot.SlotActionType;
-import net.minecraft.text.Text;
+import net.minecraft.client.input.MouseButtonEvent;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
+import net.minecraft.client.input.KeyEvent;
+import net.minecraft.world.entity.player.Inventory;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.inventory.AbstractContainerMenu;
+import net.minecraft.world.inventory.Slot;
+import net.minecraft.world.inventory.ClickType;
+import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -27,32 +27,32 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(value = HandledScreen.class, priority = 990)
-public abstract class MixinHandledScreen<T extends ScreenHandler> {
+@Mixin(value = AbstractContainerScreen.class, priority = 990)
+public abstract class MixinHandledScreen<T extends AbstractContainerMenu> {
@Shadow
@Final
- protected T handler;
+ protected T menu;
@Shadow
- public abstract T getScreenHandler();
+ public abstract T getMenu();
@Shadow
- protected int y;
+ protected int topPos;
@Shadow
- protected int x;
+ protected int leftPos;
@Unique
- PlayerInventory playerInventory;
+ Inventory playerInventory;
@Inject(method = "<init>", at = @At("TAIL"))
- public void savePlayerInventory(ScreenHandler handler, PlayerInventory inventory, Text title, CallbackInfo ci) {
+ public void savePlayerInventory(AbstractContainerMenu handler, Inventory inventory, Component title, CallbackInfo ci) {
this.playerInventory = inventory;
}
- @Inject(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;keyPressed(Lnet/minecraft/client/input/KeyInput;)Z", shift = At.Shift.BEFORE), cancellable = true)
- public void onKeyPressed(KeyInput input, CallbackInfoReturnable<Boolean> cir) {
+ @Inject(method = "keyPressed", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;keyPressed(Lnet/minecraft/client/input/KeyEvent;)Z", shift = At.Shift.BEFORE), cancellable = true)
+ public void onKeyPressed(KeyEvent input, CallbackInfoReturnable<Boolean> cir) {
if (HandledScreenKeyPressedEvent.Companion.publish(new HandledScreenKeyPressedEvent(
- (HandledScreen<?>) (Object) this,
+ (AbstractContainerScreen<?>) (Object) this,
GenericInputAction.of(input),
InputModifiers.of(input))).getCancelled()) {
cir.setReturnValue(true);
@@ -60,16 +60,16 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
}
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
- public void onMouseClicked(Click click, boolean doubled, CallbackInfoReturnable<Boolean> cir) {
- if (HandledScreenKeyPressedEvent.Companion.publish(new HandledScreenKeyPressedEvent((HandledScreen<?>) (Object) this,
+ public void onMouseClicked(MouseButtonEvent click, boolean doubled, CallbackInfoReturnable<Boolean> cir) {
+ if (HandledScreenKeyPressedEvent.Companion.publish(new HandledScreenKeyPressedEvent((AbstractContainerScreen<?>) (Object) this,
GenericInputAction.mouse(click), InputModifiers.current())).getCancelled()) {
cir.setReturnValue(true);
}
}
@Inject(method = "mouseReleased", at = @At("HEAD"), cancellable = true)
- private void onMouseReleased(Click click, CallbackInfoReturnable<Boolean> cir) {
- var self = (HandledScreen<?>) (Object) this;
+ private void onMouseReleased(MouseButtonEvent click, CallbackInfoReturnable<Boolean> cir) {
+ var self = (AbstractContainerScreen<?>) (Object) this;
var clickEvent = new HandledScreenClickEvent(self, click.x(), click.y(), click.button());
var keyEvent = new HandledScreenKeyReleasedEvent(self, GenericInputAction.mouse(click), InputModifiers.current());
if (HandledScreenClickEvent.Companion.publish(clickEvent).getCancelled()
@@ -78,16 +78,16 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
}
}
- @Inject(method = "renderMain", at = @At("HEAD"))
- public void onAfterRenderForeground(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
- HandledScreenForegroundEvent.Companion.publish(new HandledScreenForegroundEvent((HandledScreen<?>) (Object) this, context, mouseX, mouseY, delta));
+ @Inject(method = "renderContents", at = @At("HEAD"))
+ public void onAfterRenderForeground(GuiGraphics context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
+ HandledScreenForegroundEvent.Companion.publish(new HandledScreenForegroundEvent((AbstractContainerScreen<?>) (Object) this, context, mouseX, mouseY, delta));
}
- @Inject(method = "onMouseClick(Lnet/minecraft/screen/slot/Slot;IILnet/minecraft/screen/slot/SlotActionType;)V", at = @At("HEAD"), cancellable = true)
- public void onMouseClickedSlot(Slot slot, int slotId, int button, SlotActionType actionType, CallbackInfo ci) {
- if (slotId == -999 && getScreenHandler() != null && actionType == SlotActionType.PICKUP) { // -999 is code for "clicked outside the main window"
- ItemStack cursorStack = getScreenHandler().getCursorStack();
- if (cursorStack != null && IsSlotProtectedEvent.shouldBlockInteraction(slot, SlotActionType.THROW, IsSlotProtectedEvent.MoveOrigin.INVENTORY_MOVE, cursorStack)) {
+ @Inject(method = "slotClicked(Lnet/minecraft/world/inventory/Slot;IILnet/minecraft/world/inventory/ClickType;)V", at = @At("HEAD"), cancellable = true)
+ public void onMouseClickedSlot(Slot slot, int slotId, int button, ClickType actionType, CallbackInfo ci) {
+ if (slotId == -999 && getMenu() != null && actionType == ClickType.PICKUP) { // -999 is code for "clicked outside the main window"
+ ItemStack cursorStack = getMenu().getCarried();
+ if (cursorStack != null && IsSlotProtectedEvent.shouldBlockInteraction(slot, ClickType.THROW, IsSlotProtectedEvent.MoveOrigin.INVENTORY_MOVE, cursorStack)) {
ci.cancel();
return;
}
@@ -96,7 +96,7 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
ci.cancel();
return;
}
- if (actionType == SlotActionType.SWAP && 0 <= button && button < 9) {
+ if (actionType == ClickType.SWAP && 0 <= button && button < 9) {
if (IsSlotProtectedEvent.shouldBlockInteraction(new Slot(playerInventory, button, 0, 0), actionType, IsSlotProtectedEvent.MoveOrigin.INVENTORY_MOVE)) {
ci.cancel();
}
@@ -104,8 +104,8 @@ public abstract class MixinHandledScreen<T extends ScreenHandler> {
}
- @WrapOperation(method = "drawSlots", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/screen/slot/Slot;)V"))
- public void onDrawSlots(HandledScreen instance, DrawContext context, Slot slot, Operation<Void> original) {
+ @WrapOperation(method = "renderSlots", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderSlot(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/inventory/Slot;)V"))
+ public void onDrawSlots(AbstractContainerScreen instance, GuiGraphics context, Slot slot, Operation<Void> original) {
var before = new SlotRenderEvents.Before(context, slot);
SlotRenderEvents.Before.Companion.publish(before);
original.call(instance, context, slot);
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java b/src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java
index 12455f4..2210c9e 100644
--- a/src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java
+++ b/src/main/java/moe/nea/firmament/mixins/MixinPlayerScreenHandler.java
@@ -1,27 +1,27 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.features.fixes.Fixes;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.screen.PlayerScreenHandler;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.entity.player.Inventory;
+import net.minecraft.world.inventory.InventoryMenu;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(PlayerScreenHandler.class)
+@Mixin(InventoryMenu.class)
public class MixinPlayerScreenHandler {
@Unique
private static final int OFF_HAND_SLOT = 40;
@Inject(method = "<init>", at = @At("TAIL"))
- private void moveOffHandSlot(PlayerInventory inventory, boolean onServer, PlayerEntity owner, CallbackInfo ci) {
+ private void moveOffHandSlot(Inventory inventory, boolean onServer, Player owner, CallbackInfo ci) {
if (Fixes.TConfig.INSTANCE.getHideOffHand()) {
- PlayerScreenHandler self = (PlayerScreenHandler) (Object) this;
+ InventoryMenu self = (InventoryMenu) (Object) this;
self.slots.stream()
- .filter(slot -> slot.getIndex() == OFF_HAND_SLOT)
+ .filter(slot -> slot.getContainerSlot() == OFF_HAND_SLOT)
.forEach(slot -> {
slot.x = -1000;
slot.y = -1000;
diff --git a/src/main/java/moe/nea/firmament/mixins/MixinRecipeBookScreen.java b/src/main/java/moe/nea/firmament/mixins/MixinRecipeBookScreen.java
index 2dbe738..d0ec17c 100644
--- a/src/main/java/moe/nea/firmament/mixins/MixinRecipeBookScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/MixinRecipeBookScreen.java
@@ -1,15 +1,15 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.features.fixes.Fixes;
-import net.minecraft.client.gui.screen.ingame.RecipeBookScreen;
+import net.minecraft.client.gui.screens.inventory.AbstractRecipeBookScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(value = RecipeBookScreen.class, priority = 999)
+@Mixin(value = AbstractRecipeBookScreen.class, priority = 999)
public class MixinRecipeBookScreen {
- @Inject(method = "addRecipeBook", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "initButton", at = @At("HEAD"), cancellable = true)
public void addRecipeBook(CallbackInfo ci) {
if (Fixes.TConfig.INSTANCE.getHideRecipeBook()) ci.cancel();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java b/src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java
index fd2de97..e0ae61b 100644
--- a/src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/MousePressInWorldEventPatch.java
@@ -5,16 +5,16 @@ import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.events.WorldKeyboardEvent;
import moe.nea.firmament.keybindings.GenericInputAction;
import moe.nea.firmament.keybindings.InputModifiers;
-import net.minecraft.client.Mouse;
-import net.minecraft.client.input.MouseInput;
-import net.minecraft.client.util.InputUtil;
+import net.minecraft.client.MouseHandler;
+import net.minecraft.client.input.MouseButtonInfo;
+import com.mojang.blaze3d.platform.InputConstants;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-@Mixin(Mouse.class)
+@Mixin(MouseHandler.class)
public class MousePressInWorldEventPatch {
- @WrapWithCondition(method = "onMouseButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/option/KeyBinding;onKeyPressed(Lnet/minecraft/client/util/InputUtil$Key;)V"))
- public boolean onKeyBoardInWorld(InputUtil.Key key, @Local(argsOnly = true) MouseInput input) { // TODO: handle modified mouse click instead
+ @WrapWithCondition(method = "onButton", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/KeyMapping;click(Lcom/mojang/blaze3d/platform/InputConstants$Key;)V"))
+ public boolean onKeyBoardInWorld(InputConstants.Key key, @Local(argsOnly = true) MouseButtonInfo input) { // TODO: handle modified mouse click instead
var event = WorldKeyboardEvent.Companion.publish(new WorldKeyboardEvent(GenericInputAction.of(input),
InputModifiers.of(input)));
return !event.getCancelled();
diff --git a/src/main/java/moe/nea/firmament/mixins/OutgoingPacketEventPatch.java b/src/main/java/moe/nea/firmament/mixins/OutgoingPacketEventPatch.java
index 25505b7..fd6869c 100644
--- a/src/main/java/moe/nea/firmament/mixins/OutgoingPacketEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/OutgoingPacketEventPatch.java
@@ -3,16 +3,16 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.events.OutgoingPacketEvent;
-import net.minecraft.client.network.ClientCommonNetworkHandler;
-import net.minecraft.network.packet.Packet;
+import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
+import net.minecraft.network.protocol.Packet;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ClientCommonNetworkHandler.class)
+@Mixin(ClientCommonPacketListenerImpl.class)
public class OutgoingPacketEventPatch {
- @Inject(method = "sendPacket(Lnet/minecraft/network/packet/Packet;)V", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "send(Lnet/minecraft/network/protocol/Packet;)V", at = @At("HEAD"), cancellable = true)
public void onSendPacket(Packet<?> packet, CallbackInfo ci) {
if (OutgoingPacketEvent.Companion.publish(new OutgoingPacketEvent(packet)).getCancelled()) {
ci.cancel();
diff --git a/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java b/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java
index 86f6806..9ee271d 100644
--- a/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/PlayerDropEventPatch.java
@@ -3,25 +3,25 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.events.IsSlotProtectedEvent;
-import net.minecraft.client.network.ClientPlayerEntity;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.screen.slot.Slot;
-import net.minecraft.screen.slot.SlotActionType;
+import net.minecraft.client.player.LocalPlayer;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.inventory.Slot;
+import net.minecraft.world.inventory.ClickType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(ClientPlayerEntity.class)
-public abstract class PlayerDropEventPatch extends PlayerEntity {
+@Mixin(LocalPlayer.class)
+public abstract class PlayerDropEventPatch extends Player {
public PlayerDropEventPatch() {
super(null, null);
}
- @Inject(method = "dropSelectedItem", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "drop", at = @At("HEAD"), cancellable = true)
public void onDropSelectedItem(boolean entireStack, CallbackInfoReturnable<Boolean> cir) {
Slot fakeSlot = new Slot(getInventory(), getInventory().getSelectedSlot(), 0, 0);
- if (IsSlotProtectedEvent.shouldBlockInteraction(fakeSlot, SlotActionType.THROW, IsSlotProtectedEvent.MoveOrigin.DROP_FROM_HOTBAR)) {
+ if (IsSlotProtectedEvent.shouldBlockInteraction(fakeSlot, ClickType.THROW, IsSlotProtectedEvent.MoveOrigin.DROP_FROM_HOTBAR)) {
cir.setReturnValue(false);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/ResourceReloaderRegistrationPatch.java b/src/main/java/moe/nea/firmament/mixins/ResourceReloaderRegistrationPatch.java
index 28fe3d9..a29cdc0 100644
--- a/src/main/java/moe/nea/firmament/mixins/ResourceReloaderRegistrationPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/ResourceReloaderRegistrationPatch.java
@@ -2,9 +2,9 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.events.FinalizeResourceManagerEvent;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.RunArgs;
-import net.minecraft.resource.ReloadableResourceManagerImpl;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.main.GameConfig;
+import net.minecraft.server.packs.resources.ReloadableResourceManager;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -12,14 +12,14 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(MinecraftClient.class)
+@Mixin(Minecraft.class)
public class ResourceReloaderRegistrationPatch {
@Shadow
@Final
- private ReloadableResourceManagerImpl resourceManager;
+ private ReloadableResourceManager resourceManager;
- @Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/resource/ResourcePackManager;createResourcePacks()Ljava/util/List;", shift = At.Shift.BEFORE))
- private void onBeforeResourcePackCreation(RunArgs args, CallbackInfo ci) {
+ @Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/packs/repository/PackRepository;openAllSelected()Ljava/util/List;", shift = At.Shift.BEFORE))
+ private void onBeforeResourcePackCreation(GameConfig args, CallbackInfo ci) {
FinalizeResourceManagerEvent.Companion.publish(new FinalizeResourceManagerEvent(this.resourceManager));
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/SaveCursorPositionPatch.java b/src/main/java/moe/nea/firmament/mixins/SaveCursorPositionPatch.java
index 3659066..3cfd0d6 100644
--- a/src/main/java/moe/nea/firmament/mixins/SaveCursorPositionPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/SaveCursorPositionPatch.java
@@ -4,7 +4,7 @@ package moe.nea.firmament.mixins;
import kotlin.Pair;
import moe.nea.firmament.features.inventory.SaveCursorPosition;
-import net.minecraft.client.Mouse;
+import net.minecraft.client.MouseHandler;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -12,29 +12,29 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(Mouse.class)
+@Mixin(MouseHandler.class)
public class SaveCursorPositionPatch {
@Shadow
- private double x;
+ private double xpos;
@Shadow
- private double y;
+ private double ypos;
- @Inject(method = "lockCursor", at = @At(value = "HEAD"))
+ @Inject(method = "grabMouse", at = @At(value = "HEAD"))
public void onLockCursor(CallbackInfo ci) {
- SaveCursorPosition.saveCursorOriginal(x, y);
+ SaveCursorPosition.saveCursorOriginal(xpos, ypos);
}
- @Inject(method = "lockCursor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getWindow()Lnet/minecraft/client/util/Window;", ordinal = 2))
+ @Inject(method = "grabMouse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getWindow()Lcom/mojang/blaze3d/platform/Window;", ordinal = 2))
public void onLockCursorAfter(CallbackInfo ci) {
- SaveCursorPosition.saveCursorMiddle(x, y);
+ SaveCursorPosition.saveCursorMiddle(xpos, ypos);
}
- @Inject(method = "unlockCursor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;getWindow()Lnet/minecraft/client/util/Window;", ordinal = 2))
+ @Inject(method = "releaseMouse", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;getWindow()Lcom/mojang/blaze3d/platform/Window;", ordinal = 2))
public void onUnlockCursor(CallbackInfo ci) {
- Pair<Double, Double> cursorPosition = SaveCursorPosition.loadCursor(this.x, this.y);
+ Pair<Double, Double> cursorPosition = SaveCursorPosition.loadCursor(this.xpos, this.ypos);
if (cursorPosition == null) return;
- this.x = cursorPosition.getFirst();
- this.y = cursorPosition.getSecond();
+ this.xpos = cursorPosition.getFirst();
+ this.ypos = cursorPosition.getSecond();
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/SaveOriginalCommandTreePacket.java b/src/main/java/moe/nea/firmament/mixins/SaveOriginalCommandTreePacket.java
index 2f2f188..5974277 100644
--- a/src/main/java/moe/nea/firmament/mixins/SaveOriginalCommandTreePacket.java
+++ b/src/main/java/moe/nea/firmament/mixins/SaveOriginalCommandTreePacket.java
@@ -1,17 +1,17 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.features.chat.QuickCommands;
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.network.packet.s2c.play.CommandTreeS2CPacket;
+import net.minecraft.client.multiplayer.ClientPacketListener;
+import net.minecraft.network.protocol.game.ClientboundCommandsPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ClientPlayNetworkHandler.class)
+@Mixin(ClientPacketListener.class)
public class SaveOriginalCommandTreePacket {
- @Inject(method = "onCommandTree", at = @At(value = "RETURN"))
- private void saveUnmodifiedCommandTree(CommandTreeS2CPacket packet, CallbackInfo ci) {
+ @Inject(method = "handleCommands", at = @At(value = "RETURN"))
+ private void saveUnmodifiedCommandTree(ClientboundCommandsPacket packet, CallbackInfo ci) {
QuickCommands.INSTANCE.setLastReceivedTreePacket(packet);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/ScreenChangeEventPatch.java b/src/main/java/moe/nea/firmament/mixins/ScreenChangeEventPatch.java
index 6d19405..37423f0 100644
--- a/src/main/java/moe/nea/firmament/mixins/ScreenChangeEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/ScreenChangeEventPatch.java
@@ -5,8 +5,8 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import moe.nea.firmament.events.ScreenChangeEvent;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.screens.Screen;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -14,15 +14,15 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(MinecraftClient.class)
+@Mixin(Minecraft.class)
public abstract class ScreenChangeEventPatch {
@Shadow
@Nullable
- public Screen currentScreen;
+ public Screen screen;
@Inject(method = "setScreen", at = @At("HEAD"), cancellable = true)
public void onScreenChange(Screen screen, CallbackInfo ci, @Local(argsOnly = true) LocalRef<Screen> screenLocalRef) {
- var event = new ScreenChangeEvent(currentScreen, screen);
+ var event = new ScreenChangeEvent(screen, screen);
if (ScreenChangeEvent.Companion.publish(event).getCancelled()) {
ci.cancel();
} else if (event.getOverrideScreen() != null) {
diff --git a/src/main/java/moe/nea/firmament/mixins/SlotClickEventPatch.java b/src/main/java/moe/nea/firmament/mixins/SlotClickEventPatch.java
index 21e7899..71cb05a 100644
--- a/src/main/java/moe/nea/firmament/mixins/SlotClickEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/SlotClickEventPatch.java
@@ -5,11 +5,11 @@ import com.llamalad7.mixinextras.sugar.Local;
import com.llamalad7.mixinextras.sugar.Share;
import com.llamalad7.mixinextras.sugar.ref.LocalRef;
import moe.nea.firmament.events.SlotClickEvent;
-import net.minecraft.client.network.ClientPlayerInteractionManager;
-import net.minecraft.entity.player.PlayerEntity;
-import net.minecraft.item.ItemStack;
-import net.minecraft.screen.ScreenHandler;
-import net.minecraft.screen.slot.SlotActionType;
+import net.minecraft.client.multiplayer.MultiPlayerGameMode;
+import net.minecraft.world.entity.player.Player;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.inventory.AbstractContainerMenu;
+import net.minecraft.world.inventory.ClickType;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -17,18 +17,18 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ClientPlayerInteractionManager.class)
+@Mixin(MultiPlayerGameMode.class)
public class SlotClickEventPatch {
- @Inject(method = "clickSlot", at = @At(value = "FIELD", target = "Lnet/minecraft/screen/ScreenHandler;slots:Lnet/minecraft/util/collection/DefaultedList;", opcode = Opcodes.GETFIELD))
- private void onSlotClickSaveSlot(int syncId, int slotId, int button, SlotActionType actionType, PlayerEntity player, CallbackInfo ci, @Local ScreenHandler handler, @Share("slotContent") LocalRef<ItemStack> slotContent) {
+ @Inject(method = "handleInventoryMouseClick", at = @At(value = "FIELD", target = "Lnet/minecraft/world/inventory/AbstractContainerMenu;slots:Lnet/minecraft/core/NonNullList;", opcode = Opcodes.GETFIELD))
+ private void onSlotClickSaveSlot(int syncId, int slotId, int button, ClickType actionType, Player player, CallbackInfo ci, @Local AbstractContainerMenu handler, @Share("slotContent") LocalRef<ItemStack> slotContent) {
if (0 <= slotId && slotId < handler.slots.size()) {
- slotContent.set(handler.getSlot(slotId).getStack().copy());
+ slotContent.set(handler.getSlot(slotId).getItem().copy());
}
}
- @Inject(method = "clickSlot", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayNetworkHandler;sendPacket(Lnet/minecraft/network/packet/Packet;)V"))
- private void onSlotClick(int syncId, int slotId, int button, SlotActionType actionType, PlayerEntity player, CallbackInfo ci, @Local ScreenHandler handler, @Share("slotContent") LocalRef<ItemStack> slotContent) {
+ @Inject(method = "handleInventoryMouseClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientPacketListener;sendPacket(Lnet/minecraft/network/protocol/Packet;)V"))
+ private void onSlotClick(int syncId, int slotId, int button, ClickType actionType, Player player, CallbackInfo ci, @Local AbstractContainerMenu handler, @Share("slotContent") LocalRef<ItemStack> slotContent) {
if (0 <= slotId && slotId < handler.slots.size()) {
SlotClickEvent.Companion.publish(new SlotClickEvent(
handler.getSlot(slotId),
diff --git a/src/main/java/moe/nea/firmament/mixins/SlotUpdateListener.java b/src/main/java/moe/nea/firmament/mixins/SlotUpdateListener.java
index a4ae931..49661d0 100644
--- a/src/main/java/moe/nea/firmament/mixins/SlotUpdateListener.java
+++ b/src/main/java/moe/nea/firmament/mixins/SlotUpdateListener.java
@@ -3,51 +3,51 @@ package moe.nea.firmament.mixins;
import moe.nea.firmament.events.ChestInventoryUpdateEvent;
import moe.nea.firmament.events.PlayerInventoryUpdate;
-import net.minecraft.client.MinecraftClient;
-import net.minecraft.client.network.ClientCommonNetworkHandler;
-import net.minecraft.client.network.ClientConnectionState;
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.network.ClientConnection;
-import net.minecraft.network.packet.s2c.play.InventoryS2CPacket;
-import net.minecraft.network.packet.s2c.play.ScreenHandlerSlotUpdateS2CPacket;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.multiplayer.ClientCommonPacketListenerImpl;
+import net.minecraft.client.multiplayer.CommonListenerCookie;
+import net.minecraft.client.multiplayer.ClientPacketListener;
+import net.minecraft.network.Connection;
+import net.minecraft.network.protocol.game.ClientboundContainerSetContentPacket;
+import net.minecraft.network.protocol.game.ClientboundContainerSetSlotPacket;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(ClientPlayNetworkHandler.class)
-public abstract class SlotUpdateListener extends ClientCommonNetworkHandler {
- protected SlotUpdateListener(MinecraftClient client, ClientConnection connection, ClientConnectionState connectionState) {
+@Mixin(ClientPacketListener.class)
+public abstract class SlotUpdateListener extends ClientCommonPacketListenerImpl {
+ protected SlotUpdateListener(Minecraft client, Connection connection, CommonListenerCookie connectionState) {
super(client, connection, connectionState);
}
@Inject(
- method = "onScreenHandlerSlotUpdate",
+ method = "handleContainerSetSlot",
at = @At(value = "TAIL"))
private void onSingleSlotUpdate(
- ScreenHandlerSlotUpdateS2CPacket packet,
+ ClientboundContainerSetSlotPacket packet,
CallbackInfo ci) {
- var player = this.client.player;
+ var player = this.minecraft.player;
assert player != null;
- if (packet.getSyncId() == 0) {
- PlayerInventoryUpdate.Companion.publish(new PlayerInventoryUpdate.Single(packet.getSlot(), packet.getStack()));
- } else if (packet.getSyncId() == player.currentScreenHandler.syncId) {
+ if (packet.getContainerId() == 0) {
+ PlayerInventoryUpdate.Companion.publish(new PlayerInventoryUpdate.Single(packet.getSlot(), packet.getItem()));
+ } else if (packet.getContainerId() == player.containerMenu.containerId) {
ChestInventoryUpdateEvent.Companion.publish(
- new ChestInventoryUpdateEvent.Single(packet.getSlot(), packet.getStack())
+ new ChestInventoryUpdateEvent.Single(packet.getSlot(), packet.getItem())
);
}
}
- @Inject(method = "onInventory",
+ @Inject(method = "handleContainerContent",
at = @At("TAIL"))
- private void onMultiSlotUpdate(InventoryS2CPacket packet, CallbackInfo ci) {
- var player = this.client.player;
+ private void onMultiSlotUpdate(ClientboundContainerSetContentPacket packet, CallbackInfo ci) {
+ var player = this.minecraft.player;
assert player != null;
- if (packet.syncId() == 0) {
- PlayerInventoryUpdate.Companion.publish(new PlayerInventoryUpdate.Multi(packet.contents()));
- } else if (packet.syncId() == player.currentScreenHandler.syncId) {
+ if (packet.containerId() == 0) {
+ PlayerInventoryUpdate.Companion.publish(new PlayerInventoryUpdate.Multi(packet.items()));
+ } else if (packet.containerId() == player.containerMenu.containerId) {
ChestInventoryUpdateEvent.Companion.publish(
- new ChestInventoryUpdateEvent.Multi(packet.contents())
+ new ChestInventoryUpdateEvent.Multi(packet.items())
);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/SoundReceiveEventPatch.java b/src/main/java/moe/nea/firmament/mixins/SoundReceiveEventPatch.java
index b8cba80..af80325 100644
--- a/src/main/java/moe/nea/firmament/mixins/SoundReceiveEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/SoundReceiveEventPatch.java
@@ -3,25 +3,25 @@ package moe.nea.firmament.mixins;
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
import moe.nea.firmament.events.SoundReceiveEvent;
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.client.world.ClientWorld;
-import net.minecraft.entity.Entity;
-import net.minecraft.registry.entry.RegistryEntry;
-import net.minecraft.sound.SoundCategory;
-import net.minecraft.sound.SoundEvent;
-import net.minecraft.util.math.Vec3d;
+import net.minecraft.client.multiplayer.ClientPacketListener;
+import net.minecraft.client.multiplayer.ClientLevel;
+import net.minecraft.world.entity.Entity;
+import net.minecraft.core.Holder;
+import net.minecraft.sounds.SoundSource;
+import net.minecraft.sounds.SoundEvent;
+import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-@Mixin(ClientPlayNetworkHandler.class)
+@Mixin(ClientPacketListener.class)
public class SoundReceiveEventPatch {
- @WrapWithCondition(method = "onPlaySound", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld;playSound(Lnet/minecraft/entity/Entity;DDDLnet/minecraft/registry/entry/RegistryEntry;Lnet/minecraft/sound/SoundCategory;FFJ)V"))
- private boolean postEventWhenSoundIsPlayed(ClientWorld instance, @Nullable Entity source, double x, double y, double z, RegistryEntry<SoundEvent> sound, SoundCategory category, float volume, float pitch, long seed) {
+ @WrapWithCondition(method = "handleSoundEvent", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/multiplayer/ClientLevel;playSound(Lnet/minecraft/world/entity/Entity;DDDLnet/minecraft/core/Holder;Lnet/minecraft/sounds/SoundSource;FFJ)V"))
+ private boolean postEventWhenSoundIsPlayed(ClientLevel instance, @Nullable Entity source, double x, double y, double z, Holder<SoundEvent> sound, SoundSource category, float volume, float pitch, long seed) {
var event = new SoundReceiveEvent(
sound,
category,
- new Vec3d(x,y,z),
+ new Vec3(x,y,z),
pitch,
volume,
seed
diff --git a/src/main/java/moe/nea/firmament/mixins/ToggleSprintPatch.java b/src/main/java/moe/nea/firmament/mixins/ToggleSprintPatch.java
index 1acbf20..96d03bd 100644
--- a/src/main/java/moe/nea/firmament/mixins/ToggleSprintPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/ToggleSprintPatch.java
@@ -3,16 +3,16 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.features.fixes.Fixes;
-import net.minecraft.client.option.KeyBinding;
+import net.minecraft.client.KeyMapping;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(KeyBinding.class)
+@Mixin(KeyMapping.class)
public class ToggleSprintPatch {
- @Inject(method = "isPressed", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "isDown", at = @At("HEAD"), cancellable = true)
public void onIsPressed(CallbackInfoReturnable<Boolean> cir) {
- Fixes.INSTANCE.handleIsPressed((KeyBinding) (Object) this, cir);
+ Fixes.INSTANCE.handleIsPressed((KeyMapping) (Object) this, cir);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/TolerateFirmamentTolerateRegistryOwners.java b/src/main/java/moe/nea/firmament/mixins/TolerateFirmamentTolerateRegistryOwners.java
index ac6f614..bc0ece5 100644
--- a/src/main/java/moe/nea/firmament/mixins/TolerateFirmamentTolerateRegistryOwners.java
+++ b/src/main/java/moe/nea/firmament/mixins/TolerateFirmamentTolerateRegistryOwners.java
@@ -1,16 +1,16 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.util.mc.TolerantRegistriesOps;
-import net.minecraft.registry.entry.RegistryEntryOwner;
+import net.minecraft.core.HolderOwner;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(RegistryEntryOwner.class)
+@Mixin(HolderOwner.class)
public interface TolerateFirmamentTolerateRegistryOwners<T> {
- @Inject(method = "ownerEquals", at = @At("HEAD"), cancellable = true)
- private void equalTolerantRegistryOwners(RegistryEntryOwner<T> other, CallbackInfoReturnable<Boolean> cir) {
+ @Inject(method = "canSerializeIn", at = @At("HEAD"), cancellable = true)
+ private void equalTolerantRegistryOwners(HolderOwner<T> other, CallbackInfoReturnable<Boolean> cir) {
if (other instanceof TolerantRegistriesOps.TolerantOwner<?>) {
cir.setReturnValue(true);
}
diff --git a/src/main/java/moe/nea/firmament/mixins/WorldReadyEventPatch.java b/src/main/java/moe/nea/firmament/mixins/WorldReadyEventPatch.java
index f05eb05..70ef9cb 100644
--- a/src/main/java/moe/nea/firmament/mixins/WorldReadyEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/WorldReadyEventPatch.java
@@ -3,15 +3,15 @@
package moe.nea.firmament.mixins;
import moe.nea.firmament.events.WorldReadyEvent;
-import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(MinecraftClient.class)
+@Mixin(Minecraft.class)
public class WorldReadyEventPatch {
- @Inject(method = "joinWorld", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;setWorld(Lnet/minecraft/client/world/ClientWorld;)V", shift = At.Shift.AFTER))
+ @Inject(method = "setLevel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;updateLevelInEngines(Lnet/minecraft/client/multiplayer/ClientLevel;)V", shift = At.Shift.AFTER))
public void onClose(CallbackInfo ci) {
WorldReadyEvent.Companion.publish(new WorldReadyEvent());
}
diff --git a/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java b/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
index 162d1dc..a875bcf 100644
--- a/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
@@ -4,13 +4,15 @@ package moe.nea.firmament.mixins;
import com.mojang.blaze3d.buffers.GpuBufferSlice;
import moe.nea.firmament.events.WorldRenderLastEvent;
-import net.minecraft.client.render.*;
-import net.minecraft.client.render.fog.FogRenderer;
-import net.minecraft.client.render.state.WorldRenderState;
-import net.minecraft.client.util.Handle;
-import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.client.world.ClientWorld;
-import net.minecraft.util.profiler.Profiler;
+import net.minecraft.client.renderer.LevelRenderer;
+import net.minecraft.client.renderer.LevelTargetBundle;
+import net.minecraft.client.renderer.RenderBuffers;
+import net.minecraft.client.renderer.culling.Frustum;
+import net.minecraft.client.renderer.state.LevelRenderState;
+import com.mojang.blaze3d.resource.ResourceHandle;
+import com.mojang.blaze3d.vertex.PoseStack;
+import net.minecraft.client.multiplayer.ClientLevel;
+import net.minecraft.util.profiling.ProfilerFiller;
import org.jetbrains.annotations.Nullable;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Final;
@@ -20,29 +22,22 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(WorldRenderer.class)
+@Mixin(LevelRenderer.class)
public abstract class WorldRenderLastEventPatch {
@Shadow
@Final
- private BufferBuilderStorage bufferBuilders;
+ private RenderBuffers renderBuffers;
@Shadow
- @Final
- private DefaultFramebufferSet framebufferSet;
-
- @Shadow
- protected abstract void checkEmpty(MatrixStack matrices);
-
- @Shadow
- private @Nullable ClientWorld world;
+ protected abstract void checkPoseStack(PoseStack matrices);
@Shadow
private int ticks;
- @Inject(method = "method_62214", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiler/Profiler;pop()V", shift = At.Shift.AFTER))
- public void onWorldRenderLast(GpuBufferSlice gpuBufferSlice, WorldRenderState worldRenderState, Profiler profiler, Matrix4f matrix4f, Handle handle, Handle handle2, boolean bl, Frustum frustum, Handle handle3, Handle handle4, CallbackInfo ci) {
- var imm = this.bufferBuilders.getEntityVertexConsumers();
- var stack = new MatrixStack();
+ @Inject(method = "method_62214", at = @At(value = "INVOKE", target = "Lnet/minecraft/util/profiling/ProfilerFiller;pop()V", shift = At.Shift.AFTER))
+ public void onWorldRenderLast(GpuBufferSlice gpuBufferSlice, LevelRenderState worldRenderState, ProfilerFiller profiler, Matrix4f matrix4f, ResourceHandle handle, ResourceHandle handle2, boolean bl, Frustum frustum, ResourceHandle handle3, ResourceHandle handle4, CallbackInfo ci) {
+ var imm = this.renderBuffers.bufferSource();
+ var stack = new PoseStack();
// TODO: pre-cancel this event if F1 is active
var event = new WorldRenderLastEvent(
stack, ticks,
@@ -50,7 +45,7 @@ public abstract class WorldRenderLastEventPatch {
imm
);
WorldRenderLastEvent.Companion.publish(event);
- imm.draw();
- checkEmpty(stack);
+ imm.endBatch();
+ checkPoseStack(stack);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorAbstractClientPlayerEntity.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorAbstractClientPlayerEntity.java
index 0a10046..cbd143d 100644
--- a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorAbstractClientPlayerEntity.java
+++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorAbstractClientPlayerEntity.java
@@ -1,13 +1,13 @@
package moe.nea.firmament.mixins.accessor;
-import net.minecraft.client.network.AbstractClientPlayerEntity;
-import net.minecraft.client.network.PlayerListEntry;
+import net.minecraft.client.player.AbstractClientPlayer;
+import net.minecraft.client.multiplayer.PlayerInfo;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
-@Mixin(AbstractClientPlayerEntity.class)
+@Mixin(AbstractClientPlayer.class)
public interface AccessorAbstractClientPlayerEntity {
- @Accessor("playerListEntry")
- void setPlayerListEntry_firmament(PlayerListEntry playerListEntry);
+ @Accessor("playerInfo")
+ void setPlayerListEntry_firmament(PlayerInfo playerListEntry);
}
diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorChatHud.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorChatHud.java
index d164aac..0b986ef 100644
--- a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorChatHud.java
+++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorChatHud.java
@@ -1,24 +1,24 @@
package moe.nea.firmament.mixins.accessor;
-import net.minecraft.client.gui.hud.ChatHud;
-import net.minecraft.client.gui.hud.ChatHudLine;
+import net.minecraft.client.gui.components.ChatComponent;
+import net.minecraft.client.GuiMessage;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import org.spongepowered.asm.mixin.gen.Invoker;
import java.util.List;
-@Mixin(ChatHud.class)
+@Mixin(ChatComponent.class)
public interface AccessorChatHud {
- @Accessor("messages")
- List<ChatHudLine> getMessages_firmament();
+ @Accessor("allMessages")
+ List<GuiMessage> getMessages_firmament();
- @Accessor("visibleMessages")
- List<ChatHudLine.Visible> getVisibleMessages_firmament();
+ @Accessor("trimmedMessages")
+ List<GuiMessage.Line> getVisibleMessages_firmament();
- @Accessor("scrolledLines")
+ @Accessor("chatScrollbarPos")
int getScrolledLines_firmament();
- @Invoker("toChatLineY")
+ @Invoker("screenToChatY")
double toChatLineY_firmament(double y);
}
diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java
index f55ef4f..5e0c669 100644
--- a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorHandledScreen.java
@@ -1,39 +1,39 @@
package moe.nea.firmament.mixins.accessor;
-import net.minecraft.client.gui.screen.ingame.HandledScreen;
-import net.minecraft.screen.slot.Slot;
+import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
+import net.minecraft.world.inventory.Slot;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
-@Mixin(HandledScreen.class)
+@Mixin(AbstractContainerScreen.class)
public interface AccessorHandledScreen {
- @Accessor("focusedSlot")
+ @Accessor("hoveredSlot")
@Nullable
- Slot getFocusedSlot_Firmament();
+ Slot getFocusedSlot_Firmament();
- @Accessor("backgroundWidth")
+ @Accessor("imageWidth")
int getBackgroundWidth_Firmament();
- @Accessor("backgroundWidth")
+ @Accessor("imageWidth")
void setBackgroundWidth_Firmament(int newBackgroundWidth);
- @Accessor("backgroundHeight")
+ @Accessor("imageHeight")
int getBackgroundHeight_Firmament();
- @Accessor("backgroundHeight")
+ @Accessor("imageHeight")
void setBackgroundHeight_Firmament(int newBackgroundHeight);
- @Accessor("x")
+ @Accessor("leftPos")
int getX_Firmament();
- @Accessor("x")
+ @Accessor("leftPos")
void setX_Firmament(int newX);
- @Accessor("y")
+ @Accessor("topPos")
int getY_Firmament();
- @Accessor("y")
+ @Accessor("topPos")
void setY_Firmament(int newY);
}
diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorNbtComponent.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorNbtComponent.java
index 8ce981c..672badf 100644
--- a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorNbtComponent.java
+++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorNbtComponent.java
@@ -1,12 +1,12 @@
package moe.nea.firmament.mixins.accessor;
-import net.minecraft.component.type.NbtComponent;
-import net.minecraft.nbt.NbtCompound;
+import net.minecraft.world.item.component.CustomData;
+import net.minecraft.nbt.CompoundTag;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
-@Mixin(NbtComponent.class)
+@Mixin(CustomData.class)
public interface AccessorNbtComponent {
- @Accessor("nbt")
- NbtCompound getUnsafeNbt_firmament();
+ @Accessor("tag")
+ CompoundTag getUnsafeNbt_firmament();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorPlayerListHud.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorPlayerListHud.java
index 81ea0fd..58c9ad9 100644
--- a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorPlayerListHud.java
+++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorPlayerListHud.java
@@ -1,8 +1,8 @@
package moe.nea.firmament.mixins.accessor;
-import net.minecraft.client.gui.hud.PlayerListHud;
-import net.minecraft.client.network.PlayerListEntry;
-import net.minecraft.text.Text;
+import net.minecraft.client.gui.components.PlayerTabOverlay;
+import net.minecraft.client.multiplayer.PlayerInfo;
+import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
@@ -11,21 +11,21 @@ import org.spongepowered.asm.mixin.gen.Invoker;
import java.util.Comparator;
import java.util.List;
-@Mixin(PlayerListHud.class)
+@Mixin(PlayerTabOverlay.class)
public interface AccessorPlayerListHud {
- @Accessor("ENTRY_ORDERING")
- static Comparator<PlayerListEntry> getEntryOrdering() {
+ @Accessor("PLAYER_COMPARATOR")
+ static Comparator<PlayerInfo> getEntryOrdering() {
throw new AssertionError();
}
- @Invoker("collectPlayerEntries")
- List<PlayerListEntry> collectPlayerEntries_firmament();
+ @Invoker("getPlayerInfos")
+ List<PlayerInfo> collectPlayerEntries_firmament();
@Accessor("footer")
- @Nullable Text getFooter_firmament();
+ @Nullable Component getFooter_firmament();
@Accessor("header")
- @Nullable Text getHeader_firmament();
+ @Nullable Component getHeader_firmament();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorScreenHandler.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorScreenHandler.java
index a022d8e..0a75ea1 100644
--- a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorScreenHandler.java
+++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorScreenHandler.java
@@ -1,12 +1,12 @@
package moe.nea.firmament.mixins.accessor;
-import net.minecraft.screen.ScreenHandler;
-import net.minecraft.screen.ScreenHandlerType;
+import net.minecraft.world.inventory.AbstractContainerMenu;
+import net.minecraft.world.inventory.MenuType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
-@Mixin(ScreenHandler.class)
+@Mixin(AbstractContainerMenu.class)
public interface AccessorScreenHandler {
- @Accessor("type")
- ScreenHandlerType<?> getType_firmament();
+ @Accessor("menuType")
+ MenuType<?> getType_firmament();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorWorldRenderer.java b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorWorldRenderer.java
index 8b25562..9164af0 100644
--- a/src/main/java/moe/nea/firmament/mixins/accessor/AccessorWorldRenderer.java
+++ b/src/main/java/moe/nea/firmament/mixins/accessor/AccessorWorldRenderer.java
@@ -1,17 +1,17 @@
package moe.nea.firmament.mixins.accessor;
import it.unimi.dsi.fastutil.longs.Long2ObjectMap;
-import net.minecraft.client.render.WorldRenderer;
-import net.minecraft.entity.player.BlockBreakingInfo;
+import net.minecraft.client.renderer.LevelRenderer;
+import net.minecraft.server.level.BlockDestructionProgress;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import java.util.SortedSet;
-@Mixin(WorldRenderer.class)
+@Mixin(LevelRenderer.class)
public interface AccessorWorldRenderer {
- @Accessor("blockBreakingProgressions")
+ @Accessor("destructionProgress")
@NotNull
- Long2ObjectMap<SortedSet<BlockBreakingInfo>> getBlockBreakingProgressions_firmament();
+ Long2ObjectMap<SortedSet<BlockDestructionProgress>> getBlockBreakingProgressions_firmament();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/customgui/OriginalSlotCoords.java b/src/main/java/moe/nea/firmament/mixins/customgui/OriginalSlotCoords.java
index c705625..203b87e 100644
--- a/src/main/java/moe/nea/firmament/mixins/customgui/OriginalSlotCoords.java
+++ b/src/main/java/moe/nea/firmament/mixins/customgui/OriginalSlotCoords.java
@@ -2,7 +2,7 @@
package moe.nea.firmament.mixins.customgui;
import moe.nea.firmament.util.customgui.CoordRememberingSlot;
-import net.minecraft.screen.slot.Slot;
+import net.minecraft.world.inventory.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
diff --git a/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java b/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java
index 3769ceb..41787e4 100644
--- a/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java
+++ b/src/main/java/moe/nea/firmament/mixins/customgui/PatchHandledScreen.java
@@ -10,15 +10,15 @@ import moe.nea.firmament.keybindings.InputModifiers;
import moe.nea.firmament.util.customgui.CoordRememberingSlot;
import moe.nea.firmament.util.customgui.CustomGui;
import moe.nea.firmament.util.customgui.HasCustomGui;
-import net.minecraft.client.gui.Click;
-import net.minecraft.client.gui.DrawContext;
-import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.client.gui.screen.ingame.HandledScreen;
-import net.minecraft.client.input.CharInput;
-import net.minecraft.client.input.KeyInput;
-import net.minecraft.screen.ScreenHandler;
-import net.minecraft.screen.slot.Slot;
-import net.minecraft.text.Text;
+import net.minecraft.client.input.MouseButtonEvent;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraft.client.gui.screens.Screen;
+import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
+import net.minecraft.client.input.CharacterEvent;
+import net.minecraft.client.input.KeyEvent;
+import net.minecraft.world.inventory.AbstractContainerMenu;
+import net.minecraft.world.inventory.Slot;
+import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
@@ -29,19 +29,19 @@ import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-@Mixin(HandledScreen.class)
-public class PatchHandledScreen<T extends ScreenHandler> extends Screen implements HasCustomGui {
+@Mixin(AbstractContainerScreen.class)
+public class PatchHandledScreen<T extends AbstractContainerMenu> extends Screen implements HasCustomGui {
@Shadow
@Final
- protected T handler;
+ protected T menu;
@Shadow
- protected int x;
+ protected int leftPos;
@Shadow
- protected int y;
+ protected int topPos;
@Shadow
- protected int backgroundHeight;
+ protected int imageHeight;
@Shadow
- protected int backgroundWidth;
+ protected int imageWidth;
@Unique
public CustomGui override;
@Unique
@@ -51,7 +51,7 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
@Unique
private int originalBackgroundHeight;
- protected PatchHandledScreen(Text title) {
+ protected PatchHandledScreen(Component title) {
super(title);
}
@@ -64,12 +64,12 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
@Override
public void setCustomGui_Firmament(@Nullable CustomGui gui) {
if (this.override != null) {
- backgroundHeight = originalBackgroundHeight;
- backgroundWidth = originalBackgroundWidth;
+ imageHeight = originalBackgroundHeight;
+ imageWidth = originalBackgroundWidth;
}
if (gui != null) {
- originalBackgroundHeight = backgroundHeight;
- originalBackgroundWidth = backgroundWidth;
+ originalBackgroundHeight = imageHeight;
+ originalBackgroundWidth = imageWidth;
}
this.override = gui;
}
@@ -78,16 +78,16 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
return override != null && override.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount);
}
- public boolean keyReleased_firmament(KeyInput input) {
+ public boolean keyReleased_firmament(KeyEvent input) {
if (HandledScreenKeyReleasedEvent.Companion.publish(new HandledScreenKeyReleasedEvent(
- (HandledScreen<?>) (Object) this,
+ (AbstractContainerScreen<?>) (Object) this,
GenericInputAction.of(input),
InputModifiers.of(input))).getCancelled())
return true;
return override != null && override.keyReleased(input);
}
- public boolean charTyped_firmament(CharInput input) {
+ public boolean charTyped_firmament(CharacterEvent input) {
return override != null && override.charTyped(input);
}
@@ -98,19 +98,19 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
}
}
- @Inject(method = "drawForeground", at = @At("HEAD"), cancellable = true)
- private void onDrawForeground(DrawContext context, int mouseX, int mouseY, CallbackInfo ci) {
+ @Inject(method = "renderLabels", at = @At("HEAD"), cancellable = true)
+ private void onDrawForeground(GuiGraphics context, int mouseX, int mouseY, CallbackInfo ci) {
if (override != null && !override.shouldDrawForeground())
ci.cancel();
}
@WrapOperation(
- method = "drawSlots",
+ method = "renderSlots",
at = @At(
value = "INVOKE",
- target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawSlot(Lnet/minecraft/client/gui/DrawContext;Lnet/minecraft/screen/slot/Slot;)V"))
- private void beforeSlotRender(HandledScreen instance, DrawContext context, Slot slot, Operation<Void> original) {
+ target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderSlot(Lnet/minecraft/client/gui/GuiGraphics;Lnet/minecraft/world/inventory/Slot;)V"))
+ private void beforeSlotRender(AbstractContainerScreen instance, GuiGraphics context, Slot slot, Operation<Void> original) {
if (override != null) {
override.beforeSlotRender(context, slot);
}
@@ -120,7 +120,7 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
}
}
- @Inject(method = "isClickOutsideBounds", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "hasClickedOutside", at = @At("HEAD"), cancellable = true)
public void onIsClickOutsideBounds(
double mouseX, double mouseY, int left, int top,
CallbackInfoReturnable<Boolean> cir) {
@@ -129,24 +129,24 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
}
}
- @Inject(method = "isPointWithinBounds", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "isHovering", at = @At("HEAD"), cancellable = true)
public void onIsPointWithinBounds(int x, int y, int width, int height, double pointX, double pointY, CallbackInfoReturnable<Boolean> cir) {
if (override != null) {
- cir.setReturnValue(override.isPointWithinBounds(x + this.x, y + this.y, width, height, pointX, pointY));
+ cir.setReturnValue(override.isPointWithinBounds(x + this.leftPos, y + this.topPos, width, height, pointX, pointY));
}
}
- @Inject(method = "isPointOverSlot", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "isHovering", at = @At("HEAD"), cancellable = true)
public void onIsPointOverSlot(Slot slot, double pointX, double pointY, CallbackInfoReturnable<Boolean> cir) {
if (override != null) {
- cir.setReturnValue(override.isPointOverSlot(slot, this.x, this.y, pointX, pointY));
+ cir.setReturnValue(override.isPointOverSlot(slot, this.leftPos, this.topPos, pointX, pointY));
}
}
@Inject(method = "renderBackground", at = @At("HEAD"))
- public void moveSlots(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
+ public void moveSlots(GuiGraphics context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
if (override != null) {
- for (Slot slot : handler.slots) {
+ for (Slot slot : menu.slots) {
if (!hasRememberedSlots) {
((CoordRememberingSlot) slot).rememberCoords_firmament();
}
@@ -155,7 +155,7 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
hasRememberedSlots = true;
} else {
if (hasRememberedSlots) {
- for (Slot slot : handler.slots) {
+ for (Slot slot : menu.slots) {
((CoordRememberingSlot) slot).restoreCoords_firmament();
}
hasRememberedSlots = false;
@@ -163,7 +163,7 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
}
}
- @Inject(at = @At("HEAD"), method = "close", cancellable = true)
+ @Inject(at = @At("HEAD"), method = "onClose", cancellable = true)
private void onVoluntaryExit(CallbackInfo ci) {
if (override != null) {
if (!override.onVoluntaryExit())
@@ -171,8 +171,8 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
}
}
- @WrapWithCondition(method = "renderBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;drawBackground(Lnet/minecraft/client/gui/DrawContext;FII)V"))
- public boolean preventDrawingBackground(HandledScreen instance, DrawContext drawContext, float delta, int mouseX, int mouseY) {
+ @WrapWithCondition(method = "renderBackground", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/inventory/AbstractContainerScreen;renderBg(Lnet/minecraft/client/gui/GuiGraphics;FII)V"))
+ public boolean preventDrawingBackground(AbstractContainerScreen instance, GuiGraphics drawContext, float delta, int mouseX, int mouseY) {
if (override != null) {
override.render(drawContext, delta, mouseX, mouseY);
}
@@ -181,8 +181,8 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
@WrapOperation(
method = "mouseClicked",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/Screen;mouseClicked(Lnet/minecraft/client/gui/Click;Z)Z"))
- public boolean overrideMouseClicks(HandledScreen instance, Click click, boolean doubled, Operation<Boolean> original) {
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screens/Screen;mouseClicked(Lnet/minecraft/client/input/MouseButtonEvent;Z)Z"))
+ public boolean overrideMouseClicks(AbstractContainerScreen instance, MouseButtonEvent click, boolean doubled, Operation<Boolean> original) {
if (override != null) {
if (override.mouseClick(click, doubled))
return true;
@@ -191,7 +191,7 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
}
@Inject(method = "mouseDragged", at = @At("HEAD"), cancellable = true)
- public void overrideMouseDrags(Click click, double offsetX, double offsetY, CallbackInfoReturnable<Boolean> cir) {
+ public void overrideMouseDrags(MouseButtonEvent click, double offsetX, double offsetY, CallbackInfoReturnable<Boolean> cir) {
if (override != null) {
if (override.mouseDragged(click, offsetX, offsetY))
cir.setReturnValue(true);
@@ -199,7 +199,7 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
}
@Inject(method = "keyPressed", at = @At("HEAD"), cancellable = true)
- private void overrideKeyPressed(KeyInput input, CallbackInfoReturnable<Boolean> cir) {
+ private void overrideKeyPressed(KeyEvent input, CallbackInfoReturnable<Boolean> cir) {
if (override != null) {
if (override.keyPressed(input)) {
cir.setReturnValue(true);
@@ -211,7 +211,7 @@ public class PatchHandledScreen<T extends ScreenHandler> extends Screen implemen
@Inject(
method = "mouseReleased",
at = @At("HEAD"), cancellable = true)
- public void overrideMouseReleases(Click click, CallbackInfoReturnable<Boolean> cir) {
+ public void overrideMouseReleases(MouseButtonEvent click, CallbackInfoReturnable<Boolean> cir) {
if (override != null) {
if (override.mouseReleased(click))
cir.setReturnValue(true);
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
index a15d825..2744fb4 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
@@ -2,9 +2,9 @@
package moe.nea.firmament.mixins.devenv;
-import net.minecraft.client.network.ClientPlayNetworkHandler;
-import net.minecraft.network.packet.CustomPayload;
-import net.minecraft.util.Identifier;
+import net.minecraft.client.multiplayer.ClientPacketListener;
+import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
+import net.minecraft.resources.ResourceLocation;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -14,27 +14,27 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.util.Objects;
-@Mixin(ClientPlayNetworkHandler.class)
+@Mixin(ClientPacketListener.class)
public class DisableCommonPacketWarnings {
- @Inject(method = "warnOnUnknownPayload", at = @At("HEAD"), cancellable = true)
- public void onCustomPacketError(CustomPayload customPayload, CallbackInfo ci) {
- if (Objects.equals(customPayload.getId(), Identifier.of("badlion", "mods"))) {
+ @Inject(method = "handleUnknownCustomPayload", at = @At("HEAD"), cancellable = true)
+ public void onCustomPacketError(CustomPacketPayload customPayload, CallbackInfo ci) {
+ if (Objects.equals(customPayload.type(), ResourceLocation.fromNamespaceAndPath("badlion", "mods"))) {
ci.cancel();
}
}
- @Redirect(method = "onEntityPassengersSet", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;)V", remap = false))
+ @Redirect(method = "handleSetEntityPassengersPacket", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;)V", remap = false))
public void onUnknownPassenger(Logger instance, String s) {
// Ignore passenger data for unknown entities, since HyPixel just sends a lot of those.
}
- @Redirect(method = "onTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;[Ljava/lang/Object;)V", remap = false))
+ @Redirect(method = "handleSetPlayerTeamPacket", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;[Ljava/lang/Object;)V", remap = false))
public void onOnTeam(Logger instance, String s, Object[] objects) {
// Ignore data for unknown teams, since HyPixel just sends a lot of invalid team data.
}
- @Redirect(method = "onPlayerList", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
+ @Redirect(method = "handlePlayerInfoUpdate", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
public void onOnPlayerList(Logger instance, String s, Object o, Object o2) {
// Ignore invalid player info, since HyPixel just sends a lot of invalid player info
}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java b/src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java
index 689a757..ffcfefa 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/DisableInvalidFishingHook.java
@@ -2,15 +2,15 @@
package moe.nea.firmament.mixins.devenv;
-import net.minecraft.entity.projectile.FishingBobberEntity;
+import net.minecraft.world.entity.projectile.FishingHook;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
-@Mixin(FishingBobberEntity.class)
+@Mixin(FishingHook.class)
public class DisableInvalidFishingHook {
- @Redirect(method = "onSpawnPacket", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
+ @Redirect(method = "recreateFromPacket", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;error(Ljava/lang/String;Ljava/lang/Object;Ljava/lang/Object;)V", remap = false))
public void onOnSpawnPacket(Logger instance, String s, Object o, Object o1) {
// Don't warn for broken fishing hooks, since HyPixel sends a bunch of those
}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/EarlyInstantiateTranslations.java b/src/main/java/moe/nea/firmament/mixins/devenv/EarlyInstantiateTranslations.java
index ef8c9eb..849525f 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/EarlyInstantiateTranslations.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/EarlyInstantiateTranslations.java
@@ -1,19 +1,19 @@
package moe.nea.firmament.mixins.devenv;
-import net.minecraft.text.TranslatableTextContent;
+import net.minecraft.network.chat.contents.TranslatableContents;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(TranslatableTextContent.class)
+@Mixin(TranslatableContents.class)
public abstract class EarlyInstantiateTranslations {
@Shadow
- protected abstract void updateTranslations();
+ protected abstract void decompose();
@Inject(method = "<init>", at = @At("TAIL"))
private void onInit(String key, String fallback, Object[] args, CallbackInfo ci) {
- updateTranslations();
+ decompose();
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java
index 6620b47..c71f337 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java
@@ -1,7 +1,7 @@
package moe.nea.firmament.mixins.devenv;
-import net.minecraft.client.util.Window;
+import com.mojang.blaze3d.platform.Window;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java
index cedfb95..cc04493 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java
@@ -1,19 +1,19 @@
package moe.nea.firmament.mixins.devenv;
-import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(MinecraftClient.class)
+@Mixin(Minecraft.class)
public class IdentifyStopperPatch {
@Shadow
private volatile boolean running;
- @Inject(method = "scheduleStop", at = @At("HEAD"))
+ @Inject(method = "stop", at = @At("HEAD"))
private void onStop(CallbackInfo ci) {
if (this.running)
Thread.dumpStack();
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/MixinKeyboard.java b/src/main/java/moe/nea/firmament/mixins/devenv/MixinKeyboard.java
index d7b6cc3..7d5fc80 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/MixinKeyboard.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/MixinKeyboard.java
@@ -3,18 +3,18 @@
package moe.nea.firmament.mixins.devenv;
import moe.nea.firmament.features.debug.DeveloperFeatures;
-import net.minecraft.client.Keyboard;
-import net.minecraft.client.MinecraftClient;
+import net.minecraft.client.KeyboardHandler;
+import net.minecraft.client.Minecraft;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import java.util.concurrent.CompletableFuture;
-@Mixin(Keyboard.class)
+@Mixin(KeyboardHandler.class)
public class MixinKeyboard {
- @Redirect(method = "processF3", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/MinecraftClient;reloadResources()Ljava/util/concurrent/CompletableFuture;"))
- public CompletableFuture<Void> redirectReloadResources(MinecraftClient instance) {
+ @Redirect(method = "handleDebugKeys", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;reloadResourcePacks()Ljava/util/concurrent/CompletableFuture;"))
+ public CompletableFuture<Void> redirectReloadResources(Minecraft instance) {
return DeveloperFeatures.hookOnBeforeResourceReload(instance);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java b/src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java
index 34a733c..d96cac9 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/MixinScoreboard.java
@@ -2,7 +2,7 @@
package moe.nea.firmament.mixins.devenv;
-import net.minecraft.scoreboard.Scoreboard;
+import net.minecraft.world.scores.Scoreboard;
import org.slf4j.Logger;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
@@ -10,7 +10,8 @@ import org.spongepowered.asm.mixin.injection.Redirect;
@Mixin(Scoreboard.class)
public class MixinScoreboard {
- @Redirect(method = "addTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
+ // TODO(Ravel): target method addTeam is ambiguous
+ @Redirect(method = "addTeam", at = @At(value = "INVOKE", target = "Lorg/slf4j/Logger;warn(Ljava/lang/String;Ljava/lang/Object;)V", remap = false))
public void onExistingteam(Logger instance, String s, Object o) {
// Ignore creations of existing teams
}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/WarnForUnknownCustomPayloadSends.java b/src/main/java/moe/nea/firmament/mixins/devenv/WarnForUnknownCustomPayloadSends.java
index 6d44e29..9a96df2 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/WarnForUnknownCustomPayloadSends.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/WarnForUnknownCustomPayloadSends.java
@@ -2,17 +2,17 @@
package moe.nea.firmament.mixins.devenv;
import moe.nea.firmament.Firmament;
-import net.minecraft.network.PacketByteBuf;
-import net.minecraft.network.packet.UnknownCustomPayload;
+import net.minecraft.network.FriendlyByteBuf;
+import net.minecraft.network.protocol.common.custom.DiscardedPayload;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
-@Mixin(UnknownCustomPayload.class)
+@Mixin(DiscardedPayload.class)
public class WarnForUnknownCustomPayloadSends {
@Inject(method = "method_56493", at = @At("HEAD"))
- private static void warn(UnknownCustomPayload value, PacketByteBuf buf, CallbackInfo ci) {
+ private static void warn(DiscardedPayload value, FriendlyByteBuf buf, CallbackInfo ci) {
Firmament.INSTANCE.getLogger().warn("Unknown custom payload is being sent: {}", value);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/WarnOnMissingTranslations.java b/src/main/java/moe/nea/firmament/mixins/devenv/WarnOnMissingTranslations.java
index 33840c1..e513a97 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/WarnOnMissingTranslations.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/WarnOnMissingTranslations.java
@@ -2,8 +2,8 @@ package moe.nea.firmament.mixins.devenv;
import moe.nea.firmament.features.debug.DeveloperFeatures;
import moe.nea.firmament.util.MC;
-import net.minecraft.client.resource.language.TranslationStorage;
-import net.minecraft.text.Text;
+import net.minecraft.client.resources.language.ClientLanguage;
+import net.minecraft.network.chat.Component;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
@@ -14,15 +14,15 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import java.util.Set;
import java.util.TreeSet;
-@Mixin(TranslationStorage.class)
+@Mixin(ClientLanguage.class)
public abstract class WarnOnMissingTranslations {
@Shadow
- public abstract boolean hasTranslation(String key);
+ public abstract boolean has(String key);
@Unique
private final Set<String> missingTranslations = new TreeSet<>();
- @Inject(method = "get", at = @At("HEAD"))
+ @Inject(method = "getOrDefault", at = @At("HEAD"))
private void onGetTranslationKey(String key, String fallback, CallbackInfoReturnable<String> cir) {
warnForMissingTranslation(key);
}
@@ -30,9 +30,9 @@ public abstract class WarnOnMissingTranslations {
@Unique
private void warnForMissingTranslation(String key) {
if (!key.contains("firmament")) return;
- if (hasTranslation(key)) return;
+ if (has(key)) return;
if (!missingTranslations.add(key)) return;
- MC.INSTANCE.sendChat(Text.literal("Missing firmament translation: " + key));
+ MC.INSTANCE.sendChat(Component.literal("Missing firmament translation: " + key));
DeveloperFeatures.hookMissingTranslations(missingTranslations);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java b/src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java
index 0abed22..475a5bf 100644
--- a/src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java
+++ b/src/main/java/moe/nea/firmament/mixins/feature/DisableSlotHighlights.java
@@ -1,9 +1,9 @@
package moe.nea.firmament.mixins.feature;
import moe.nea.firmament.features.fixes.Fixes;
-import net.minecraft.component.DataComponentTypes;
-import net.minecraft.item.ItemStack;
-import net.minecraft.screen.slot.Slot;
+import net.minecraft.core.component.DataComponents;
+import net.minecraft.world.item.ItemStack;
+import net.minecraft.world.inventory.Slot;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
@@ -13,12 +13,12 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(Slot.class)
public abstract class DisableSlotHighlights {
@Shadow
- public abstract ItemStack getStack();
+ public abstract ItemStack getItem();
- @Inject(method = "canBeHighlighted", at = @At("HEAD"), cancellable = true)
+ @Inject(method = "isHighlightable", at = @At("HEAD"), cancellable = true)
private void dontHighlight(CallbackInfoReturnable<Boolean> cir) {
if (!Fixes.TConfig.INSTANCE.getHideSlotHighlights()) return;
- var display = getStack().get(DataComponentTypes.TOOLTIP_DISPLAY);
+ var display = getItem().get(DataComponents.TOOLTIP_DISPLAY);
if (display != null && display.hideTooltip())
cir.setReturnValue(false);
}
diff --git a/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java b/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java
index 5d69e96..7852fc3 100644
--- a/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java
+++ b/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeFeatureRenderer.java
@@ -6,34 +6,34 @@ import com.llamalad7.mixinextras.sugar.Local;
import kotlin.Unit;
import moe.nea.firmament.features.misc.CustomCapes;
import net.minecraft.client.model.Model;
-import net.minecraft.client.render.RenderLayer;
-import net.minecraft.client.render.VertexConsumer;
-import net.minecraft.client.render.VertexConsumerProvider;
-import net.minecraft.client.render.command.ModelCommandRenderer;
-import net.minecraft.client.render.command.OrderedRenderCommandQueue;
-import net.minecraft.client.render.entity.feature.CapeFeatureRenderer;
-import net.minecraft.client.render.entity.feature.FeatureRenderer;
-import net.minecraft.client.render.entity.feature.FeatureRendererContext;
-import net.minecraft.client.render.entity.model.BipedEntityModel;
-import net.minecraft.client.render.entity.model.PlayerEntityModel;
-import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
-import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.entity.player.SkinTextures;
+import net.minecraft.client.renderer.RenderType;
+import com.mojang.blaze3d.vertex.VertexConsumer;
+import net.minecraft.client.renderer.MultiBufferSource;
+import net.minecraft.client.renderer.feature.ModelFeatureRenderer;
+import net.minecraft.client.renderer.SubmitNodeCollector;
+import net.minecraft.client.renderer.entity.layers.CapeLayer;
+import net.minecraft.client.renderer.entity.layers.RenderLayer;
+import net.minecraft.client.renderer.entity.RenderLayerParent;
+import net.minecraft.client.model.HumanoidModel;
+import net.minecraft.client.model.PlayerModel;
+import net.minecraft.client.renderer.entity.state.AvatarRenderState;
+import com.mojang.blaze3d.vertex.PoseStack;
+import net.minecraft.world.entity.player.PlayerSkin;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
-@Mixin(CapeFeatureRenderer.class)
-public abstract class CustomCapeFeatureRenderer extends FeatureRenderer<PlayerEntityRenderState, PlayerEntityModel> {
- public CustomCapeFeatureRenderer(FeatureRendererContext<PlayerEntityRenderState, PlayerEntityModel> context) {
+@Mixin(CapeLayer.class)
+public abstract class CustomCapeFeatureRenderer extends RenderLayer<AvatarRenderState, PlayerModel> {
+ public CustomCapeFeatureRenderer(RenderLayerParent<AvatarRenderState, PlayerModel> context) {
super(context);
}
@WrapOperation(
- method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/client/render/entity/state/PlayerEntityRenderState;FF)V",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;submitModel(Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/RenderLayer;IIILnet/minecraft/client/render/command/ModelCommandRenderer$CrumblingOverlayCommand;)V")
+ method = "submit(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/AvatarRenderState;FF)V",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/SubmitNodeCollector;submitModel(Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/RenderType;IIILnet/minecraft/client/renderer/feature/ModelFeatureRenderer$CrumblingOverlay;)V")
)
- private void onRender(OrderedRenderCommandQueue instance, Model model, Object o, MatrixStack matrixStack, RenderLayer renderLayer, int light, int overlay, int outlineColor, ModelCommandRenderer.CrumblingOverlayCommand crumblingOverlayCommand, Operation<Void> original,
- @Local(argsOnly = true) PlayerEntityRenderState playerEntityRenderState, @Local SkinTextures skinTextures) {
+ private void onRender(SubmitNodeCollector instance, Model model, Object o, PoseStack matrixStack, RenderType renderLayer, int light, int overlay, int outlineColor, ModelFeatureRenderer.CrumblingOverlay crumblingOverlayCommand, Operation<Void> original,
+ @Local(argsOnly = true) AvatarRenderState playerEntityRenderState, @Local PlayerSkin skinTextures) {
// TODO: 1.21.10 custom capes by pre rendering the texture id. this is more viable on this version i am fairly sure, without clogging up all of the cached image render layers
// CustomCapes.render(
// playerEntityRenderState,
diff --git a/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeStorage.java b/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeStorage.java
index 428d7ec..dc933ce 100644
--- a/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeStorage.java
+++ b/src/main/java/moe/nea/firmament/mixins/feature/devcosmetics/CustomCapeStorage.java
@@ -1,12 +1,12 @@
package moe.nea.firmament.mixins.feature.devcosmetics;
import moe.nea.firmament.features.misc.CustomCapes;
-import net.minecraft.client.render.entity.state.PlayerEntityRenderState;
+import net.minecraft.client.renderer.entity.state.AvatarRenderState;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
-@Mixin(PlayerEntityRenderState.class)
+@Mixin(AvatarRenderState.class)
public class CustomCapeStorage implements CustomCapes.CapeStorage {
@Unique
CustomCapes.CustomCape customCape;
diff --git a/src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java b/src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java
index 61ad8a3..2352dfa 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/IncreaseStackLimitSizeInDrawContext.java
@@ -1,18 +1,18 @@
package moe.nea.firmament.mixins.render;
-import net.minecraft.client.gui.DrawContext;
+import net.minecraft.client.gui.GuiGraphics;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyArg;
-@Mixin(DrawContext.class)
+@Mixin(GuiGraphics.class)
public class IncreaseStackLimitSizeInDrawContext {
// [22:00:57] [Render thread/ERROR] (Minecraft) Couldn't compile program for pipeline firmament:gui_textured_overlay_tris_circle:
// net.minecraft.client.gl.ShaderLoader$LoadException: Error encountered when linking program containing
// VS minecraft:core/position_tex_color and FS firmament:circle_discard_color.
// Log output: error: declarations for uniform `ColorModulator` are inside block `DynamicTransforms` and outside a block
@ModifyArg(
- method = "<init>(Lnet/minecraft/client/MinecraftClient;Lnet/minecraft/client/gui/render/state/GuiRenderState;)V",
+ method = "<init>(Lnet/minecraft/client/Minecraft;Lnet/minecraft/client/gui/render/state/GuiRenderState;)V",
at = @At(value = "INVOKE", target = "Lorg/joml/Matrix3x2fStack;<init>(I)V"))
private static int increaseStackSize(int stackSize) {
return Math.max(stackSize, 48);
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/ChangeColorOfLivingEntities.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/ChangeColorOfLivingEntities.java
index 79958c0..53353e2 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/ChangeColorOfLivingEntities.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/ChangeColorOfLivingEntities.java
@@ -3,14 +3,14 @@ package moe.nea.firmament.mixins.render.entitytints;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.events.EntityRenderTintEvent;
-import net.minecraft.client.render.VertexConsumerProvider;
-import net.minecraft.client.render.command.OrderedRenderCommandQueue;
-import net.minecraft.client.render.entity.LivingEntityRenderer;
-import net.minecraft.client.render.entity.model.EntityModel;
-import net.minecraft.client.render.entity.state.LivingEntityRenderState;
-import net.minecraft.client.render.state.CameraRenderState;
-import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.entity.LivingEntity;
+import net.minecraft.client.renderer.MultiBufferSource;
+import net.minecraft.client.renderer.SubmitNodeCollector;
+import net.minecraft.client.renderer.entity.LivingEntityRenderer;
+import net.minecraft.client.model.EntityModel;
+import net.minecraft.client.renderer.entity.state.LivingEntityRenderState;
+import net.minecraft.client.renderer.state.CameraRenderState;
+import com.mojang.blaze3d.vertex.PoseStack;
+import net.minecraft.world.entity.LivingEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -22,7 +22,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
*/
@Mixin(LivingEntityRenderer.class)
public class ChangeColorOfLivingEntities<T extends LivingEntity, S extends LivingEntityRenderState, M extends EntityModel<? super S>> {
- @ModifyReturnValue(method = "getMixColor", at = @At("RETURN"))
+ @ModifyReturnValue(method = "getModelTint", at = @At("RETURN"))
private int changeColor(int original, @Local(argsOnly = true) S state) {
var tintState = EntityRenderTintEvent.HasTintRenderState.cast(state);
if (tintState.getHasTintOverride_firmament())
@@ -31,8 +31,8 @@ public class ChangeColorOfLivingEntities<T extends LivingEntity, S extends Livin
}
@ModifyArg(
- method = "getOverlay",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/OverlayTexture;getU(F)I"),
+ method = "getOverlayCoords",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/OverlayTexture;u(F)I"),
allow = 1
)
private static float modifyLightOverlay(float originalWhiteOffset, @Local(argsOnly = true) LivingEntityRenderState state) {
@@ -43,8 +43,8 @@ public class ChangeColorOfLivingEntities<T extends LivingEntity, S extends Livin
return originalWhiteOffset;
}
- @Inject(method = "render(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;Lnet/minecraft/client/render/state/CameraRenderState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;pop()V"))
- private void afterRender(S livingEntityRenderState, MatrixStack matrixStack, OrderedRenderCommandQueue orderedRenderCommandQueue, CameraRenderState cameraRenderState, CallbackInfo ci) {
+ @Inject(method = "submit(Lnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/CameraRenderState;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;popPose()V"))
+ private void afterRender(S livingEntityRenderState, PoseStack matrixStack, SubmitNodeCollector orderedRenderCommandQueue, CameraRenderState cameraRenderState, CallbackInfo ci) {
// var tintState = EntityRenderTintEvent.HasTintRenderState.cast(livingEntityRenderState);
// var overlayTexture = tintState.getOverlayTexture_firmament();
// if (overlayTexture != null && vertexConsumerProvider instanceof VertexConsumerProvider.Immediate imm) {
@@ -54,8 +54,8 @@ public class ChangeColorOfLivingEntities<T extends LivingEntity, S extends Livin
// TODO: 1.21.10
}
- @Inject(method = "render(Lnet/minecraft/client/render/entity/state/LivingEntityRenderState;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;Lnet/minecraft/client/render/state/CameraRenderState;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/util/math/MatrixStack;push()V"))
- private void beforeRender(S livingEntityRenderState, MatrixStack matrixStack, OrderedRenderCommandQueue orderedRenderCommandQueue, CameraRenderState cameraRenderState, CallbackInfo ci) {
+ @Inject(method = "submit(Lnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;Lnet/minecraft/client/renderer/state/CameraRenderState;)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/vertex/PoseStack;pushPose()V"))
+ private void beforeRender(S livingEntityRenderState, PoseStack matrixStack, SubmitNodeCollector orderedRenderCommandQueue, CameraRenderState cameraRenderState, CallbackInfo ci) {
var tintState = EntityRenderTintEvent.HasTintRenderState.cast(livingEntityRenderState);
var overlayTexture = tintState.getOverlayTexture_firmament();
if (overlayTexture != null) {
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/EntityRenderStateTint.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/EntityRenderStateTint.java
index 1019027..1745fc9 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/EntityRenderStateTint.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/EntityRenderStateTint.java
@@ -2,7 +2,7 @@ package moe.nea.firmament.mixins.render.entitytints;
import moe.nea.firmament.events.EntityRenderTintEvent;
import moe.nea.firmament.util.render.TintedOverlayTexture;
-import net.minecraft.client.render.entity.state.EntityRenderState;
+import net.minecraft.client.renderer.entity.state.EntityRenderState;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/InjectIntoRenderState.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/InjectIntoRenderState.java
index 7938340..c84dbb6 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/InjectIntoRenderState.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/InjectIntoRenderState.java
@@ -1,9 +1,9 @@
package moe.nea.firmament.mixins.render.entitytints;
import moe.nea.firmament.events.EntityRenderTintEvent;
-import net.minecraft.client.render.entity.EntityRenderer;
-import net.minecraft.client.render.entity.state.EntityRenderState;
-import net.minecraft.entity.Entity;
+import net.minecraft.client.renderer.entity.EntityRenderer;
+import net.minecraft.client.renderer.entity.state.EntityRenderState;
+import net.minecraft.world.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -16,7 +16,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
public class InjectIntoRenderState<T extends Entity, S extends EntityRenderState> {
@Inject(
- method = "updateRenderState",
+ method = "extractRenderState",
at = @At("RETURN"))
private void onUpdateRenderState(T entity, S state, float tickDelta, CallbackInfo ci) {
var renderState = EntityRenderTintEvent.HasTintRenderState.cast(state);
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/ReplaceOverlayTexture.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/ReplaceOverlayTexture.java
index 61e5c65..ef8b371 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/ReplaceOverlayTexture.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/ReplaceOverlayTexture.java
@@ -2,20 +2,20 @@ package moe.nea.firmament.mixins.render.entitytints;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import moe.nea.firmament.events.EntityRenderTintEvent;
-import net.minecraft.client.render.OverlayTexture;
-import net.minecraft.client.render.RenderLayer;
+import net.minecraft.client.renderer.texture.OverlayTexture;
+import net.minecraft.client.renderer.RenderType;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
/**
* Replaces the overlay texture used by rendering with the override specified in {@link EntityRenderTintEvent#overlayOverride}
*/
-@Mixin(RenderLayer.Overlay.class)
+@Mixin(RenderType.OverlayStateShard.class)
public class ReplaceOverlayTexture {
@ModifyExpressionValue(
method = {"method_23555", "method_23556"},
expect = 2,
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;getOverlayTexture()Lnet/minecraft/client/render/OverlayTexture;"))
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GameRenderer;overlayTexture()Lnet/minecraft/client/renderer/texture/OverlayTexture;"))
private static OverlayTexture replaceOverlayTexture(OverlayTexture original) {
if (EntityRenderTintEvent.overlayOverride != null)
return EntityRenderTintEvent.overlayOverride;
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableEquipmentRenderer.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableEquipmentRenderer.java
index 8671bda..0cceea3 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableEquipmentRenderer.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableEquipmentRenderer.java
@@ -4,31 +4,31 @@ import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import moe.nea.firmament.events.EntityRenderTintEvent;
-import net.minecraft.client.render.OverlayTexture;
-import net.minecraft.client.render.RenderLayer;
-import net.minecraft.client.render.entity.equipment.EquipmentRenderer;
-import net.minecraft.util.Identifier;
+import net.minecraft.client.renderer.texture.OverlayTexture;
+import net.minecraft.client.renderer.RenderType;
+import net.minecraft.client.renderer.entity.layers.EquipmentLayerRenderer;
+import net.minecraft.resources.ResourceLocation;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
/**
- * Patch to make {@link EquipmentRenderer} use a {@link RenderLayer} that allows uses Minecraft's overlay texture, if a {@link EntityRenderTintEvent#overlayOverride} is specified.
+ * Patch to make {@link EquipmentLayerRenderer} use a {@link RenderType} that allows uses Minecraft's overlay texture, if a {@link EntityRenderTintEvent#overlayOverride} is specified.
*/
-@Mixin(EquipmentRenderer.class)
+@Mixin(EquipmentLayerRenderer.class)
public class UseOverlayableEquipmentRenderer {
- @WrapOperation(method = "render(Lnet/minecraft/client/render/entity/equipment/EquipmentModel$LayerType;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/util/Identifier;II)V",
- at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/RenderLayer;getArmorCutoutNoCull(Lnet/minecraft/util/Identifier;)Lnet/minecraft/client/render/RenderLayer;"))
- private RenderLayer replace(Identifier texture, Operation<RenderLayer> original) {
+ @WrapOperation(method = "renderLayers(Lnet/minecraft/client/resources/model/EquipmentClientInfo$LayerType;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/resources/ResourceLocation;II)V",
+ at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderType;armorCutoutNoCull(Lnet/minecraft/resources/ResourceLocation;)Lnet/minecraft/client/renderer/RenderType;"))
+ private RenderType replace(ResourceLocation texture, Operation<RenderType> original) {
if (EntityRenderTintEvent.overlayOverride != null)
- return RenderLayer.getEntityTranslucent(texture);
+ return RenderType.entityTranslucent(texture);
return original.call(texture);
}
- @ModifyExpressionValue(method = "render(Lnet/minecraft/client/render/entity/equipment/EquipmentModel$LayerType;Lnet/minecraft/registry/RegistryKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/util/Identifier;II)V",
- at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/OverlayTexture;DEFAULT_UV:I"))
+ @ModifyExpressionValue(method = "renderLayers(Lnet/minecraft/client/resources/model/EquipmentClientInfo$LayerType;Lnet/minecraft/resources/ResourceKey;Lnet/minecraft/client/model/Model;Ljava/lang/Object;Lnet/minecraft/world/item/ItemStack;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/resources/ResourceLocation;II)V",
+ at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/texture/OverlayTexture;NO_OVERLAY:I"))
private int replaceUvIndex(int original) {
if (EntityRenderTintEvent.overlayOverride != null)
- return OverlayTexture.packUv(15, 10); // TODO: store this info in a global alongside overlayOverride
+ return OverlayTexture.pack(15, 10); // TODO: store this info in a global alongside overlayOverride
return original;
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableHeadFeatureRenderer.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableHeadFeatureRenderer.java
index 0422a66..a867c81 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableHeadFeatureRenderer.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableHeadFeatureRenderer.java
@@ -2,25 +2,25 @@ package moe.nea.firmament.mixins.render.entitytints;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import moe.nea.firmament.events.EntityRenderTintEvent;
-import net.minecraft.client.render.OverlayTexture;
-import net.minecraft.client.render.RenderLayer;
-import net.minecraft.client.render.entity.feature.HeadFeatureRenderer;
+import net.minecraft.client.renderer.texture.OverlayTexture;
+import net.minecraft.client.renderer.RenderType;
+import net.minecraft.client.renderer.entity.layers.CustomHeadLayer;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
/**
- * Patch to make {@link HeadFeatureRenderer} use a {@link RenderLayer} that allows uses Minecraft's overlay texture, if a {@link EntityRenderTintEvent#overlayOverride} is specified.
+ * Patch to make {@link CustomHeadLayer} use a {@link RenderType} that allows uses Minecraft's overlay texture, if a {@link EntityRenderTintEvent#overlayOverride} is specified.
* @see UseOverlayableItemRenderer
*/
-@Mixin(HeadFeatureRenderer.class)
+@Mixin(CustomHeadLayer.class)
public class UseOverlayableHeadFeatureRenderer {
- @ModifyExpressionValue(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/client/render/entity/state/LivingEntityRenderState;FF)V",
- at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/OverlayTexture;DEFAULT_UV:I", opcode = Opcodes.GETSTATIC))
+ @ModifyExpressionValue(method = "submit(Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/renderer/entity/state/LivingEntityRenderState;FF)V",
+ at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/texture/OverlayTexture;NO_OVERLAY:I", opcode = Opcodes.GETSTATIC))
private int replaceUvIndex(int original) {
if (EntityRenderTintEvent.overlayOverride != null)
- return OverlayTexture.packUv(15, 10); // TODO: store this info in a global alongside overlayOverride
+ return OverlayTexture.pack(15, 10); // TODO: store this info in a global alongside overlayOverride
return original;
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableItemRenderer.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableItemRenderer.java
index 739fc5f..dcac77c 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableItemRenderer.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableItemRenderer.java
@@ -2,25 +2,25 @@ package moe.nea.firmament.mixins.render.entitytints;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import moe.nea.firmament.events.EntityRenderTintEvent;
-import net.minecraft.client.render.OverlayTexture;
-import net.minecraft.client.render.RenderLayer;
-import net.minecraft.client.render.RenderPhase;
-import net.minecraft.client.render.item.ItemRenderState;
+import net.minecraft.client.renderer.texture.OverlayTexture;
+import net.minecraft.client.renderer.RenderType;
+import net.minecraft.client.renderer.RenderStateShard;
+import net.minecraft.client.renderer.item.ItemStackRenderState;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
/**
- * Patch to make {@link ItemRenderState} use a {@link RenderLayer} that allows uses Minecraft's overlay texture.
+ * Patch to make {@link ItemStackRenderState} use a {@link RenderType} that allows uses Minecraft's overlay texture.
*
* @see UseOverlayableHeadFeatureRenderer
*/
-@Mixin(ItemRenderState.LayerRenderState.class)
+@Mixin(ItemStackRenderState.LayerRenderState.class)
public class UseOverlayableItemRenderer {
- @ModifyExpressionValue(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/item/ItemRenderState$LayerRenderState;renderLayer:Lnet/minecraft/client/render/RenderLayer;", opcode = Opcodes.GETFIELD))
- private RenderLayer replace(RenderLayer original) {
- if (EntityRenderTintEvent.overlayOverride != null && original instanceof RenderLayer.MultiPhase multiPhase && multiPhase.phases.texture instanceof RenderPhase.Texture texture && texture.getId().isPresent())
- return RenderLayer.getEntityTranslucent(texture.getId().get());
+ @ModifyExpressionValue(method = "submit", at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/item/ItemStackRenderState$LayerRenderState;renderType:Lnet/minecraft/client/renderer/RenderType;", opcode = Opcodes.GETFIELD))
+ private RenderType replace(RenderType original) {
+ if (EntityRenderTintEvent.overlayOverride != null && original instanceof RenderType.CompositeRenderType multiPhase && multiPhase.state.textureState instanceof RenderStateShard.TextureStateShard texture && texture.cutoutTexture().isPresent())
+ return RenderType.entityTranslucent(texture.cutoutTexture().get());
return original;
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableSkullBlockEntityRenderer.java b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableSkullBlockEntityRenderer.java
index 2a15e8c..ac102ed 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableSkullBlockEntityRenderer.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/entitytints/UseOverlayableSkullBlockEntityRenderer.java
@@ -2,23 +2,23 @@ package moe.nea.firmament.mixins.render.entitytints;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import moe.nea.firmament.events.EntityRenderTintEvent;
-import net.minecraft.client.render.OverlayTexture;
-import net.minecraft.client.render.RenderLayer;
-import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer;
+import net.minecraft.client.renderer.texture.OverlayTexture;
+import net.minecraft.client.renderer.RenderType;
+import net.minecraft.client.renderer.blockentity.SkullBlockRenderer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
/**
- * Patch to make {@link SkullBlockEntityRenderer} use a {@link RenderLayer} that allows uses Minecraft's overlay texture, if a {@link EntityRenderTintEvent#overlayOverride} is specified.
+ * Patch to make {@link SkullBlockRenderer} use a {@link RenderType} that allows uses Minecraft's overlay texture, if a {@link EntityRenderTintEvent#overlayOverride} is specified.
*/
-@Mixin(SkullBlockEntityRenderer.class)
+@Mixin(SkullBlockRenderer.class)
public class UseOverlayableSkullBlockEntityRenderer {
- @ModifyExpressionValue(method = "render(Lnet/minecraft/util/math/Direction;FFLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/command/OrderedRenderCommandQueue;ILnet/minecraft/client/render/block/entity/SkullBlockEntityModel;Lnet/minecraft/client/render/RenderLayer;ILnet/minecraft/client/render/command/ModelCommandRenderer$CrumblingOverlayCommand;)V",
- at = @At(value = "FIELD", target = "Lnet/minecraft/client/render/OverlayTexture;DEFAULT_UV:I"))
+ @ModifyExpressionValue(method = "submitSkull(Lnet/minecraft/core/Direction;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/SubmitNodeCollector;ILnet/minecraft/client/model/SkullModelBase;Lnet/minecraft/client/renderer/RenderType;ILnet/minecraft/client/renderer/feature/ModelFeatureRenderer$CrumblingOverlay;)V",
+ at = @At(value = "FIELD", target = "Lnet/minecraft/client/renderer/texture/OverlayTexture;NO_OVERLAY:I"))
private static int replaceUvIndex(int original) {
if (EntityRenderTintEvent.overlayOverride != null)
- return OverlayTexture.packUv(15, 10); // TODO: store this info in a global alongside overlayOverride
+ return OverlayTexture.pack(15, 10); // TODO: store this info in a global alongside overlayOverride
return original;
}
diff --git a/src/main/java/moe/nea/firmament/mixins/render/renderer/MultipleSpecialGuiRenderStates.java b/src/main/java/moe/nea/firmament/mixins/render/renderer/MultipleSpecialGuiRenderStates.java
index cc79591..7c37684 100644
--- a/src/main/java/moe/nea/firmament/mixins/render/renderer/MultipleSpecialGuiRenderStates.java
+++ b/src/main/java/moe/nea/firmament/mixins/render/renderer/MultipleSpecialGuiRenderStates.java
@@ -9,10 +9,10 @@ import com.mojang.blaze3d.buffers.GpuBufferSlice;
import moe.nea.firmament.util.render.MultiSpecialGuiRenderState;
import moe.nea.firmament.util.render.MultiSpecialGuiRenderer;
import net.minecraft.client.gui.render.GuiRenderer;
-import net.minecraft.client.gui.render.SpecialGuiElementRenderer;
+import net.minecraft.client.gui.render.pip.PictureInPictureRenderer;
import net.minecraft.client.gui.render.state.GuiRenderState;
-import net.minecraft.client.gui.render.state.special.SpecialGuiElementRenderState;
-import net.minecraft.client.render.VertexConsumerProvider;
+import net.minecraft.client.gui.render.state.pip.PictureInPictureRenderState;
+import net.minecraft.client.renderer.MultiBufferSource;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
@@ -31,30 +31,30 @@ import java.util.Map;
public class MultipleSpecialGuiRenderStates {
@Shadow
@Final
- private VertexConsumerProvider.Immediate vertexConsumers;
+ private MultiBufferSource.BufferSource bufferSource;
@Shadow
@Final
- GuiRenderState state;
+ GuiRenderState renderState;
@Unique
Map<MultiSpecialGuiRenderState, MultiSpecialGuiRenderer<?>> multiRenderers = new HashMap<>();
- @Inject(method = "prepareSpecialElement", at = @At("HEAD"), cancellable = true)
- private <T extends SpecialGuiElementRenderState> void onPrepareElement(T elementState, int windowScaleFactor, CallbackInfo ci) {
+ @Inject(method = "preparePictureInPictureState", at = @At("HEAD"), cancellable = true)
+ private <T extends PictureInPictureRenderState> void onPrepareElement(T elementState, int windowScaleFactor, CallbackInfo ci) {
if (elementState instanceof MultiSpecialGuiRenderState multiState) {
@SuppressWarnings({"resource", "unchecked"})
- var renderer = (SpecialGuiElementRenderer<T>) multiRenderers
- .computeIfAbsent(multiState, elementState$ -> elementState$.createRenderer(this.vertexConsumers));
- renderer.render(elementState, state, windowScaleFactor);
+ var renderer = (PictureInPictureRenderer<T>) multiRenderers
+ .computeIfAbsent(multiState, elementState$ -> elementState$.createRenderer(this.bufferSource));
+ renderer.prepare(elementState, renderState, windowScaleFactor);
ci.cancel();
}
}
@Inject(method = "close", at = @At("TAIL"))
private void onClose(CallbackInfo ci) {
- multiRenderers.values().forEach(SpecialGuiElementRenderer::close);
+ multiRenderers.values().forEach(PictureInPictureRenderer::close);
}
- @Inject(method = "render(Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/render/GuiRenderer;clearOversizedItems()V"))
+ @Inject(method = "render(Lcom/mojang/blaze3d/buffers/GpuBufferSlice;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/render/GuiRenderer;clearUnusedOversizedItemRenderers()V"))
private void onAfterRender(GpuBufferSlice fogBuffer, CallbackInfo ci) {
multiRenderers.values().removeIf(it -> {
if (it.consumeRender()) {