aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-04-26 18:04:45 +0200
committerLinnea Gräf <nea@nea.moe>2024-04-26 18:15:54 +0200
commit7e0151569477df63601be50c82177ecfd21e5deb (patch)
treef30e5440a1855de92d2b424ef79339d3d6cf5f34 /src/main/java/moe/nea/firmament
parent041da7c7d179df01c4048a81ddf40a9f13c3ce77 (diff)
downloadFirmament-7e0151569477df63601be50c82177ecfd21e5deb.tar.gz
Firmament-7e0151569477df63601be50c82177ecfd21e5deb.tar.bz2
Firmament-7e0151569477df63601be50c82177ecfd21e5deb.zip
Bump to 1.20.5
Diffstat (limited to 'src/main/java/moe/nea/firmament')
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ArmorTexturePatch.java68
-rw-r--r--src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java6
-rw-r--r--src/main/java/moe/nea/firmament/mixins/CustomSkullTexturePatch.java4
-rw-r--r--src/main/java/moe/nea/firmament/mixins/HudRenderEvents.java5
-rw-r--r--src/main/java/moe/nea/firmament/mixins/LenientProfileComponentPatch.java26
-rw-r--r--src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java8
-rw-r--r--src/main/java/moe/nea/firmament/mixins/custommodels/TestForFirmamentOverridePredicatesPatch.java4
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java3
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java21
-rw-r--r--src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java21
10 files changed, 88 insertions, 78 deletions
diff --git a/src/main/java/moe/nea/firmament/mixins/ArmorTexturePatch.java b/src/main/java/moe/nea/firmament/mixins/ArmorTexturePatch.java
deleted file mode 100644
index 4e6c1cd..0000000
--- a/src/main/java/moe/nea/firmament/mixins/ArmorTexturePatch.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
- *
- * SPDX-License-Identifier: GPL-3.0-or-later
- */
-
-package moe.nea.firmament.mixins;
-
-
-import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
-import com.llamalad7.mixinextras.sugar.Local;
-import moe.nea.firmament.features.texturepack.CustomSkyBlockTextures;
-import net.minecraft.client.render.VertexConsumer;
-import net.minecraft.client.render.VertexConsumerProvider;
-import net.minecraft.client.render.entity.feature.ArmorFeatureRenderer;
-import net.minecraft.client.render.entity.model.BipedEntityModel;
-import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.entity.EquipmentSlot;
-import net.minecraft.entity.LivingEntity;
-import net.minecraft.item.ArmorItem;
-import net.minecraft.item.ItemStack;
-import net.minecraft.util.Identifier;
-import org.jetbrains.annotations.Nullable;
-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;
-import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
-
-@Mixin(ArmorFeatureRenderer.class)
-public abstract class ArmorTexturePatch<T extends LivingEntity, M extends BipedEntityModel<T>, A extends BipedEntityModel<T>> {
- @Unique
- private ItemStack lastRenderedArmorItem;
-
- @Unique
- private boolean foundCustomTexture;
-
- @WrapWithCondition(method = "renderArmorParts", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/model/BipedEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V"))
- private boolean preventRenderingLeatherArmorColor(BipedEntityModel instance, MatrixStack matrixStack,
- VertexConsumer vertexConsumer, int light, int uv,
- float r, float g, float b, float a,
- @Local(argsOnly = true) @Nullable String overlay) {
- if (overlay != null) return true;
- if (foundCustomTexture) return true;
- var customOverlayTexture = CustomSkyBlockTextures.INSTANCE.getArmorTexture(this.lastRenderedArmorItem, false, "overlay");
- return customOverlayTexture == null;
- }
-
- @Inject(method = "renderArmor", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"))
- private void onBeforeRenderArmor(MatrixStack matrices, VertexConsumerProvider vertexConsumers,
- T entity, EquipmentSlot armorSlot, int light, A model, CallbackInfo ci,
- @Local ItemStack itemStack) {
- this.lastRenderedArmorItem = itemStack;
- }
-
- @Inject(method = "getArmorTexture", at = @At("HEAD"), cancellable = true)
- private void onGetTexture(ArmorItem item, boolean secondLayer, String overlay, CallbackInfoReturnable<Identifier> cir) {
- if (this.lastRenderedArmorItem == null) return;
- var armorTexture = CustomSkyBlockTextures.INSTANCE.getArmorTexture(this.lastRenderedArmorItem, secondLayer, overlay);
- if (armorTexture != null) {
- cir.setReturnValue(armorTexture);
- this.foundCustomTexture = true;
- } else {
- this.foundCustomTexture = false;
- }
- }
-}
diff --git a/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java b/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
index 25ba0eb..06d6202 100644
--- a/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/ChatPeekingPatch.java
@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -11,16 +12,17 @@ import moe.nea.firmament.features.fixes.Fixes;
import net.minecraft.client.gui.hud.ChatHud;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.ModifyVariable;
@Mixin(ChatHud.class)
public class ChatPeekingPatch {
- @ModifyExpressionValue(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/ChatHud;isChatFocused()Z"))
+ @ModifyVariable(method = "render", at = @At(value = "HEAD"), index = 5, argsOnly = true)
public boolean onGetChatHud(boolean old) {
return old || Fixes.INSTANCE.shouldPeekChat();
}
- @ModifyExpressionValue(method = "getHeight", 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/hud/ChatHud;isChatFocused()Z"))
public boolean onGetChatHudHeight(boolean old) {
return old || Fixes.INSTANCE.shouldPeekChat();
}
diff --git a/src/main/java/moe/nea/firmament/mixins/CustomSkullTexturePatch.java b/src/main/java/moe/nea/firmament/mixins/CustomSkullTexturePatch.java
index a8cede4..c43a53c 100644
--- a/src/main/java/moe/nea/firmament/mixins/CustomSkullTexturePatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/CustomSkullTexturePatch.java
@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -11,6 +12,7 @@ import moe.nea.firmament.features.texturepack.CustomSkyBlockTextures;
import net.minecraft.block.SkullBlock;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.block.entity.SkullBlockEntityRenderer;
+import net.minecraft.component.type.ProfileComponent;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
@@ -19,7 +21,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(SkullBlockEntityRenderer.class)
public class CustomSkullTexturePatch {
@Inject(method = "getRenderLayer", at = @At("HEAD"), cancellable = true)
- private static void onGetRenderLayer(SkullBlock.SkullType type, GameProfile profile, CallbackInfoReturnable<RenderLayer> cir) {
+ private static void onGetRenderLayer(SkullBlock.SkullType type, ProfileComponent profile, CallbackInfoReturnable<RenderLayer> cir) {
CustomSkyBlockTextures.INSTANCE.modifySkullTexture(type, profile, cir);
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/HudRenderEvents.java b/src/main/java/moe/nea/firmament/mixins/HudRenderEvents.java
index ff4e995..111ab33 100644
--- a/src/main/java/moe/nea/firmament/mixins/HudRenderEvents.java
+++ b/src/main/java/moe/nea/firmament/mixins/HudRenderEvents.java
@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -19,13 +20,13 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(InGameHud.class)
public class HudRenderEvents {
- @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/ClientPlayerEntity;getSleepTimer()I"))
+ @Inject(method = "renderSleepOverlay", at = @At(value = "TAIL"))
public void renderCallBack(DrawContext context, float tickDelta, CallbackInfo ci) {
HudRenderEvent.Companion.publish(new HudRenderEvent(context, tickDelta));
}
@Inject(method = "renderHotbarItem", at = @At("HEAD"))
- public void onRenderHotbarItem(DrawContext context, int x, int y, float tickDelta, PlayerEntity player, ItemStack stack, int seed,CallbackInfo ci) {
+ public void onRenderHotbarItem(DrawContext context, int x, int y, float tickDelta, PlayerEntity player, ItemStack stack, int seed, CallbackInfo ci) {
if (stack != null && !stack.isEmpty())
HotbarItemRenderEvent.Companion.publish(new HotbarItemRenderEvent(stack, context, x, y, tickDelta));
}
diff --git a/src/main/java/moe/nea/firmament/mixins/LenientProfileComponentPatch.java b/src/main/java/moe/nea/firmament/mixins/LenientProfileComponentPatch.java
new file mode 100644
index 0000000..75aeab1
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/LenientProfileComponentPatch.java
@@ -0,0 +1,26 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins;
+
+import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
+import com.mojang.serialization.Codec;
+import net.minecraft.component.type.ProfileComponent;
+import net.minecraft.util.Uuids;
+import org.objectweb.asm.Opcodes;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+
+import java.util.UUID;
+
+@Mixin(ProfileComponent.class)
+public class LenientProfileComponentPatch {
+ // lambda in RecordCodecBuilder.create for BASE_CODEC
+ @ModifyExpressionValue(method = "method_57508", at = @At(value = "FIELD", opcode = Opcodes.GETSTATIC, target = "Lnet/minecraft/util/Uuids;INT_STREAM_CODEC:Lcom/mojang/serialization/Codec;"))
+ private static Codec<UUID> onStaticInit(Codec<UUID> original) {
+ return Uuids.CODEC;
+ }
+}
diff --git a/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java b/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
index 268aa01..1ad1ae8 100644
--- a/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/WorldRenderLastEventPatch.java
@@ -1,11 +1,13 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package moe.nea.firmament.mixins;
+import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.events.WorldRenderLastEvent;
import net.minecraft.client.render.*;
import net.minecraft.client.util.math.MatrixStack;
@@ -24,11 +26,11 @@ public class WorldRenderLastEventPatch {
private BufferBuilderStorage bufferBuilders;
@Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/WorldRenderer;renderChunkDebugInfo(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/client/render/Camera;)V", shift = At.Shift.BEFORE))
- public void onWorldRenderLast(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) {
+ public void onWorldRenderLast(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci
+ , @Local MatrixStack matrixStack) {
var event = new WorldRenderLastEvent(
- matrices, tickDelta, renderBlockOutline,
+ matrixStack, tickDelta, renderBlockOutline,
camera, gameRenderer, lightmapTextureManager,
- positionMatrix,
this.bufferBuilders.getEntityVertexConsumers()
);
WorldRenderLastEvent.Companion.publish(event);
diff --git a/src/main/java/moe/nea/firmament/mixins/custommodels/TestForFirmamentOverridePredicatesPatch.java b/src/main/java/moe/nea/firmament/mixins/custommodels/TestForFirmamentOverridePredicatesPatch.java
index 4db9fc0..740fbc7 100644
--- a/src/main/java/moe/nea/firmament/mixins/custommodels/TestForFirmamentOverridePredicatesPatch.java
+++ b/src/main/java/moe/nea/firmament/mixins/custommodels/TestForFirmamentOverridePredicatesPatch.java
@@ -9,6 +9,7 @@ package moe.nea.firmament.mixins.custommodels;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.sugar.Local;
import moe.nea.firmament.features.texturepack.BakedOverrideData;
+import moe.nea.firmament.features.texturepack.CustomSkyBlockTextures;
import moe.nea.firmament.features.texturepack.FirmamentModelPredicate;
import moe.nea.firmament.features.texturepack.ModelOverrideData;
import net.minecraft.client.render.model.json.ModelOverride;
@@ -38,11 +39,12 @@ public class TestForFirmamentOverridePredicatesPatch {
@ModifyExpressionValue(method = "apply", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/model/json/ModelOverrideList$BakedOverride;test([F)Z"))
public boolean testFirmamentOverrides(boolean originalValue,
@Local ModelOverrideList.BakedOverride bakedOverride,
- @Local ItemStack stack) {
+ @Local(argsOnly = true) ItemStack stack) {
if (!originalValue) return false;
var overrideData = (BakedOverrideData) bakedOverride;
var overrides = overrideData.getFirmamentOverrides();
if (overrides == null) return true;
+ if (!CustomSkyBlockTextures.TConfig.INSTANCE.getEnableModelOverrides()) return false;
for (FirmamentModelPredicate firmamentOverride : overrides) {
if (!firmamentOverride.test(stack))
return false;
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 ef4f2d6..9d8da05 100644
--- a/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/DisableCommonPacketWarnings.java
@@ -1,5 +1,6 @@
/*
* SPDX-FileCopyrightText: 2023 Linnea Gräf <nea@nea.moe>
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
*
* SPDX-License-Identifier: GPL-3.0-or-later
*/
@@ -23,7 +24,7 @@ public class DisableCommonPacketWarnings {
@Inject(method = "warnOnUnknownPayload", at = @At("HEAD"), cancellable = true)
public void onCustomPacketError(CustomPayload customPayload, CallbackInfo ci) {
- if (Objects.equals(customPayload.id(), Identifier.of("badlion", "mods"))) {
+ if (Objects.equals(customPayload.getId(), Identifier.of("badlion", "mods"))) {
ci.cancel();
}
}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java
new file mode 100644
index 0000000..f89eabe
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyCloser.java
@@ -0,0 +1,21 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins.devenv;
+
+import net.minecraft.client.util.Window;
+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(Window.class)
+public class IdentifyCloser {
+ @Inject(method = "close", at = @At("HEAD"))
+ public void onClose(CallbackInfo ci) {
+ Thread.dumpStack();
+ }
+}
diff --git a/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java
new file mode 100644
index 0000000..a37e4ed
--- /dev/null
+++ b/src/main/java/moe/nea/firmament/mixins/devenv/IdentifyStopperPatch.java
@@ -0,0 +1,21 @@
+/*
+ * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe>
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+package moe.nea.firmament.mixins.devenv;
+
+import net.minecraft.client.MinecraftClient;
+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)
+public class IdentifyStopperPatch {
+ @Inject(method = "scheduleStop", at = @At("HEAD"))
+ private void onStop(CallbackInfo ci) {
+ Thread.dumpStack();
+ }
+}