-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b2e5a09
commit 1003500
Showing
6 changed files
with
69 additions
and
6 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
45 changes: 45 additions & 0 deletions
45
...n/java/com/github/dimadencep/mods/rrls/mixins/compat/ClientCommonNetworkHandlerMixin.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,45 @@ | ||
/* | ||
* Copyright 2023 dima_dencep. | ||
* | ||
* Licensed under the Open Software License, Version 3.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* | ||
* You may obtain a copy of the License at | ||
* https://github.com/dima-dencep/rrls/blob/HEAD/LICENSE | ||
*/ | ||
|
||
package com.github.dimadencep.mods.rrls.mixins.compat; | ||
|
||
import com.github.dimadencep.mods.rrls.Rrls; | ||
import com.github.dimadencep.mods.rrls.config.ModConfig; | ||
import net.minecraft.client.network.ClientCommonNetworkHandler; | ||
import net.minecraft.network.packet.c2s.common.ResourcePackStatusC2SPacket; | ||
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; | ||
|
||
import java.util.concurrent.CompletableFuture; | ||
|
||
@Mixin(ClientCommonNetworkHandler.class) | ||
public abstract class ClientCommonNetworkHandlerMixin { | ||
@Shadow | ||
protected abstract void sendResourcePackStatus(ResourcePackStatusC2SPacket.Status status); | ||
|
||
@Inject( | ||
method = "sendResourcePackStatusAfter", | ||
at = @At( | ||
value = "HEAD" | ||
), | ||
cancellable = true | ||
) | ||
public void earlyResourcePackStatusSend(CompletableFuture<?> future, CallbackInfo ci) { | ||
if (Rrls.MOD_CONFIG.earlyPackStatus.earlySend()) { | ||
sendResourcePackStatus(ResourcePackStatusC2SPacket.Status.SUCCESSFULLY_LOADED); | ||
} | ||
if (Rrls.MOD_CONFIG.earlyPackStatus == ModConfig.PackStatus.SEND_DENY) { | ||
ci.cancel(); | ||
} | ||
} | ||
} |
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