aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/moe/nea/firmament
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-08-12 22:15:07 +0200
committerLinnea Gräf <nea@nea.moe>2024-08-12 22:15:07 +0200
commitb8a45b9a0438a12ba3c609f6e416d519829471be (patch)
treeaff190bb953d94f1187896b2c245644a29e6badf /src/main/java/moe/nea/firmament
parent3c7e6b6177de6ef3cff8a46bb1726466a299cdde (diff)
downloadfirmament-b8a45b9a0438a12ba3c609f6e416d519829471be.tar.gz
firmament-b8a45b9a0438a12ba3c609f6e416d519829471be.tar.bz2
firmament-b8a45b9a0438a12ba3c609f6e416d519829471be.zip
Improve location and profile detection
Diffstat (limited to 'src/main/java/moe/nea/firmament')
-rw-r--r--src/main/java/moe/nea/firmament/init/SectionBuilderRiser.java2
-rw-r--r--src/main/java/moe/nea/firmament/mixins/custompayload/CustomPayloadEventDispatcher.java22
-rw-r--r--src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoC2SCustomPayloadPacket.java29
-rw-r--r--src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoS2CCustomPayloadPacket.java29
-rw-r--r--src/main/java/moe/nea/firmament/mixins/custompayload/SplitJoinedCustomPayload.java28
5 files changed, 1 insertions, 109 deletions
diff --git a/src/main/java/moe/nea/firmament/init/SectionBuilderRiser.java b/src/main/java/moe/nea/firmament/init/SectionBuilderRiser.java
index 2be11a6..ebb060c 100644
--- a/src/main/java/moe/nea/firmament/init/SectionBuilderRiser.java
+++ b/src/main/java/moe/nea/firmament/init/SectionBuilderRiser.java
@@ -60,7 +60,7 @@ public class SectionBuilderRiser extends RiserUtils {
return;
}
}
- new RuntimeException("Could not inject tesselation hook despite fabric renderer indigo being loaded").printStackTrace();
+ System.err.println("Could not inject indigo rendering hook. Is a custom renderer installed (e.g. sodium)?");
}
private void handleIndigo(MethodNode method) {
diff --git a/src/main/java/moe/nea/firmament/mixins/custompayload/CustomPayloadEventDispatcher.java b/src/main/java/moe/nea/firmament/mixins/custompayload/CustomPayloadEventDispatcher.java
deleted file mode 100644
index 2084821..0000000
--- a/src/main/java/moe/nea/firmament/mixins/custompayload/CustomPayloadEventDispatcher.java
+++ /dev/null
@@ -1,22 +0,0 @@
-
-package moe.nea.firmament.mixins.custompayload;
-
-import moe.nea.firmament.apis.ingame.FirmamentCustomPayload;
-import moe.nea.firmament.events.FirmamentCustomPayloadEvent;
-import net.minecraft.client.network.ClientCommonNetworkHandler;
-import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
-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 = ClientCommonNetworkHandler.class, priority = 500)
-public class CustomPayloadEventDispatcher {
- @Inject(method = "onCustomPayload(Lnet/minecraft/network/packet/s2c/common/CustomPayloadS2CPacket;)V", at = @At("HEAD"), cancellable = true)
- private void handleFirmamentParsedPayload(CustomPayloadS2CPacket packet, CallbackInfo ci) {
- if (packet.payload() instanceof FirmamentCustomPayload customPayload) {
- FirmamentCustomPayloadEvent.Companion.publishSync(new FirmamentCustomPayloadEvent(customPayload));
- ci.cancel();
- }
- }
-}
diff --git a/src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoC2SCustomPayloadPacket.java b/src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoC2SCustomPayloadPacket.java
deleted file mode 100644
index baa091e..0000000
--- a/src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoC2SCustomPayloadPacket.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-package moe.nea.firmament.mixins.custompayload;
-
-import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
-import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
-import moe.nea.firmament.apis.ingame.InGameCodecWrapper;
-import net.minecraft.network.PacketByteBuf;
-import net.minecraft.network.codec.PacketCodec;
-import net.minecraft.network.packet.CustomPayload;
-import net.minecraft.network.packet.c2s.common.CustomPayloadC2SPacket;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-
-import java.util.List;
-
-@Mixin(priority = 1001, value = CustomPayloadC2SPacket.class)
-public class InjectCustomCodecIntoC2SCustomPayloadPacket {
-
- @WrapOperation(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/CustomPayload;createCodec(Lnet/minecraft/network/packet/CustomPayload$CodecFactory;Ljava/util/List;)Lnet/minecraft/network/codec/PacketCodec;"))
- private static PacketCodec<PacketByteBuf, CustomPayload> wrapFactory(
- CustomPayload.CodecFactory<PacketByteBuf> unknownCodecFactory,
- List<CustomPayload.Type<PacketByteBuf, ?>> types,
- Operation<PacketCodec<PacketByteBuf, CustomPayload>> original) {
-
- var originalCodec = original.call(unknownCodecFactory, types);
-
- return new InGameCodecWrapper(originalCodec, InGameCodecWrapper.Direction.C2S);
- }
-}
diff --git a/src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoS2CCustomPayloadPacket.java b/src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoS2CCustomPayloadPacket.java
deleted file mode 100644
index 10c4ceb..0000000
--- a/src/main/java/moe/nea/firmament/mixins/custompayload/InjectCustomCodecIntoS2CCustomPayloadPacket.java
+++ /dev/null
@@ -1,29 +0,0 @@
-
-package moe.nea.firmament.mixins.custompayload;
-
-import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
-import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
-import moe.nea.firmament.apis.ingame.InGameCodecWrapper;
-import net.minecraft.network.PacketByteBuf;
-import net.minecraft.network.codec.PacketCodec;
-import net.minecraft.network.packet.CustomPayload;
-import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
-import org.spongepowered.asm.mixin.Mixin;
-import org.spongepowered.asm.mixin.injection.At;
-
-import java.util.List;
-
-@Mixin(priority = 1001, value = CustomPayloadS2CPacket.class)
-public abstract class InjectCustomCodecIntoS2CCustomPayloadPacket {
-
- @WrapOperation(method = "<clinit>", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/packet/CustomPayload;createCodec(Lnet/minecraft/network/packet/CustomPayload$CodecFactory;Ljava/util/List;)Lnet/minecraft/network/codec/PacketCodec;"))
- private static PacketCodec<PacketByteBuf, CustomPayload> wrapFactory(
- CustomPayload.CodecFactory<PacketByteBuf> unknownCodecFactory,
- List<CustomPayload.Type<PacketByteBuf, ?>> types,
- Operation<PacketCodec<PacketByteBuf, CustomPayload>> original) {
-
- var originalCodec = original.call(unknownCodecFactory, types);
-
- return new InGameCodecWrapper(originalCodec, InGameCodecWrapper.Direction.S2C);
- }
-}
diff --git a/src/main/java/moe/nea/firmament/mixins/custompayload/SplitJoinedCustomPayload.java b/src/main/java/moe/nea/firmament/mixins/custompayload/SplitJoinedCustomPayload.java
deleted file mode 100644
index 5320a13..0000000
--- a/src/main/java/moe/nea/firmament/mixins/custompayload/SplitJoinedCustomPayload.java
+++ /dev/null
@@ -1,28 +0,0 @@
-
-package moe.nea.firmament.mixins.custompayload;
-
-import moe.nea.firmament.apis.ingame.JoinedCustomPayload;
-import net.minecraft.network.listener.ClientCommonPacketListener;
-import net.minecraft.network.packet.CustomPayload;
-import net.minecraft.network.packet.s2c.common.CustomPayloadS2CPacket;
-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(CustomPayloadS2CPacket.class)
-public abstract class SplitJoinedCustomPayload {
-
- @Shadow
- public abstract CustomPayload payload();
-
- @Inject(method = "apply(Lnet/minecraft/network/listener/ClientCommonPacketListener;)V", at = @At("HEAD"), cancellable = true)
- private void onApply(ClientCommonPacketListener clientCommonPacketListener, CallbackInfo ci) {
- if (payload() instanceof JoinedCustomPayload joinedCustomPayload) {
- new CustomPayloadS2CPacket(joinedCustomPayload.getOriginal()).apply(clientCommonPacketListener);
- new CustomPayloadS2CPacket(joinedCustomPayload.getSmuggled()).apply(clientCommonPacketListener);
- ci.cancel();
- }
- }
-}