-
Notifications
You must be signed in to change notification settings - Fork 17
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
Showing
4 changed files
with
70 additions
and
18 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/main/java/org/polyfrost/chatting/mixin/ChatPeekMixin_SkyHanni.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,31 @@ | ||
package org.polyfrost.chatting.mixin; | ||
|
||
import cc.polyfrost.oneconfig.utils.Notifications; | ||
import org.polyfrost.chatting.config.ChattingConfig; | ||
import org.spongepowered.asm.mixin.Dynamic; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Pseudo; | ||
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.CallbackInfoReturnable; | ||
|
||
@Pseudo | ||
@Mixin(targets = {"at.hannibal2.skyhanni.features.chat.ChatPeek"}) | ||
public class ChatPeekMixin_SkyHanni { | ||
|
||
@Unique | ||
private static long chatting$lastNotify = System.currentTimeMillis(); | ||
|
||
@Dynamic("SkyHanni") | ||
@Inject(method = "peek", at = @At("HEAD"), cancellable = true, remap = false) | ||
private static void cancel(CallbackInfoReturnable<Boolean> cir) { | ||
if (!ChattingConfig.INSTANCE.getChatPeek() && cir.getReturnValue()) { | ||
if (System.currentTimeMillis() - chatting$lastNotify >= 1000) { | ||
Notifications.INSTANCE.send("Chatting", "SkyHanni's chat peek has been replaced by Chatting. You can configure this via OneConfig, by clicking the right shift key on your keyboard, or by typing /chatting in your chat."); | ||
chatting$lastNotify = System.currentTimeMillis(); | ||
} | ||
} | ||
cir.setReturnValue(false); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/org/polyfrost/chatting/mixin/GuiContainerCreativeMixin.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,20 @@ | ||
package org.polyfrost.chatting.mixin; | ||
|
||
import net.minecraft.client.gui.inventory.GuiContainerCreative; | ||
import org.polyfrost.chatting.Chatting; | ||
import org.polyfrost.chatting.config.ChattingConfig; | ||
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(GuiContainerCreative.class) | ||
public class GuiContainerCreativeMixin { | ||
|
||
@Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I"), cancellable = true) | ||
private void cancelScrolling(CallbackInfo ci) { | ||
if (Chatting.INSTANCE.getPeeking() && ChattingConfig.INSTANCE.getPeekScrolling()) { | ||
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