-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(1.20.5/network): Interrupt findCodec
Untested, there's no recipe viewer for 1.20.5 atm. Probably broken idk
- Loading branch information
Showing
9 changed files
with
67 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...main/java/io/github/null2264/cobblegen/mixin/network/packet/CustomPacketPayloadMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
//#if MC>=1.20.5 | ||
//$$ package io.github.null2264.cobblegen.mixin.network.packet; | ||
//$$ | ||
//$$ import io.github.null2264.cobblegen.data.CGIdentifier; | ||
//$$ import net.minecraft.network.FriendlyByteBuf; | ||
//$$ import net.minecraft.network.codec.StreamCodec; | ||
//$$ import net.minecraft.network.protocol.common.custom.CustomPacketPayload; | ||
//$$ import net.minecraft.resources.ResourceLocation; | ||
//$$ 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; | ||
//$$ | ||
//$$ import static io.github.null2264.cobblegen.CobbleGen.MOD_ID; | ||
//$$ import static io.github.null2264.cobblegen.util.Constants.KNOWN_PAYLOADS; | ||
//$$ | ||
//$$ @Mixin(targets = "net.minecraft.network.protocol.common.custom.CustomPacketPayload$1") | ||
//$$ public abstract class CustomPacketPayloadMixin | ||
//$$ { | ||
//$$ @Inject(method = "findCodec", at = @At("HEAD"), cancellable = true) | ||
//$$ private void getCodec( | ||
//$$ ResourceLocation id, | ||
//$$ CallbackInfoReturnable<StreamCodec<? super FriendlyByteBuf, ? extends CustomPacketPayload>> cir | ||
//$$ ) { | ||
//$$ if (!(id.getNamespace().equals(MOD_ID))) return; | ||
//$$ | ||
//$$ StreamCodec<? super FriendlyByteBuf, ? extends CustomPacketPayload> codec = | ||
//$$ KNOWN_PAYLOADS.get(CGIdentifier.fromMC(id)); | ||
//$$ if (codec == null) return; | ||
//$$ | ||
//$$ cir.setReturnValue(codec); | ||
//$$ } | ||
//$$ } | ||
//#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters