Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
SubAt0m1c committed Nov 23, 2024
2 parents 972b7a6 + 5895c63 commit 2a00bb0
Show file tree
Hide file tree
Showing 57 changed files with 173 additions and 258 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,4 @@ private void startDrawScreen(int mouseX, int mouseY, float partialTicks, Callbac
}
}
}

@Inject(method = "onGuiClosed", at = @At("HEAD"))
private void onGuiClosed(CallbackInfo ci) {
postAndCatch(new GuiEvent.Closed(odinMod$gui));
}
}
17 changes: 3 additions & 14 deletions odin/src/main/java/me/odin/mixin/mixins/MixinGuiScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,11 @@ public class MixinGuiScreen {
@Unique
private final GuiScreen odin$gui = (GuiScreen) (Object) this;

@Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "net/minecraft/client/gui/GuiScreen.mouseClicked(III)V"), cancellable = true)
private void onMouseInput(CallbackInfo ci){
if (Mouse.getEventButtonState())
if (postAndCatch(new GuiEvent.MouseClick(odin$gui, Mouse.getEventButton(), Mouse.getEventX(), Mouse.getEventY()))) ci.cancel();
}

@Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "net/minecraft/client/gui/GuiScreen.mouseReleased(III)V"), cancellable = true)
private void onReleaseMouseInput(CallbackInfo ci){
private void onReleaseMouseInput(CallbackInfo ci) {
if (!Mouse.getEventButtonState())
if (postAndCatch(new GuiEvent.GuiMouseReleaseEvent(odin$gui, Mouse.getEventButton(), Mouse.getEventX(), Mouse.getEventY()))) ci.cancel();
}

@Inject(method = "handleKeyboardInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;keyTyped(CI)V"), cancellable = true)
private void onHandleKeyboardInput(CallbackInfo ci) {
if (Keyboard.getEventKeyState())
if (postAndCatch(new GuiEvent.KeyPress(odin$gui, Keyboard.getEventKey(), Keyboard.getEventCharacter()))) ci.cancel();
if (postAndCatch(new GuiEvent.GuiMouseReleaseEvent(odin$gui, Mouse.getEventButton(), Mouse.getEventX(), Mouse.getEventY())))
ci.cancel();
}
}

7 changes: 3 additions & 4 deletions odin/src/main/java/me/odin/mixin/mixins/MixinMinecraft.java
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.odin.mixin.mixins;

import me.odinmain.events.impl.ClickEvent;
import me.odinmain.events.impl.PreKeyInputEvent;
import me.odinmain.events.impl.PreMouseInputEvent;
import me.odinmain.events.impl.InputEvent;
import me.odinmain.features.impl.render.CPSDisplay;
import me.odinmain.utils.skyblock.PlayerUtils;
import net.minecraft.client.Minecraft;
Expand All @@ -20,12 +19,12 @@ public class MixinMinecraft {

@Inject(method = {"runTick"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;dispatchKeypresses()V")})
public void keyPresses(CallbackInfo ci) {
if (Keyboard.getEventKeyState()) postAndCatch(new PreKeyInputEvent((Keyboard.getEventKey() == 0) ? (Keyboard.getEventCharacter() + 256) : Keyboard.getEventKey()));
if (Keyboard.getEventKeyState()) postAndCatch(new InputEvent.Keyboard((Keyboard.getEventKey() == 0) ? (Keyboard.getEventCharacter() + 256) : Keyboard.getEventKey()));
}

@Inject(method = {"runTick"}, at = {@At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventButton()I", remap = false)})
public void mouseKeyPresses(CallbackInfo ci) {
if (Mouse.getEventButtonState()) postAndCatch(new PreMouseInputEvent(Mouse.getEventButton()));
if (Mouse.getEventButtonState()) postAndCatch(new InputEvent.Mouse(Mouse.getEventButton()));
}

@Inject(method = {"runTick"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;handleInput()V")})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.odin.mixin.mixins;

import io.netty.channel.ChannelHandlerContext;
import me.odinmain.events.impl.PacketReceivedEvent;
import me.odinmain.events.impl.PacketSentEvent;
import me.odinmain.events.impl.PacketEvent;
import me.odinmain.utils.ServerUtils;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
Expand All @@ -18,12 +17,12 @@ public class MixinNetworkManager {

@Inject(method = "channelRead0*", at = @At("HEAD"), cancellable = true)
private void onReceivePacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
if (postAndCatch(new PacketReceivedEvent(packet)) && !ci.isCancelled()) ci.cancel();
if (postAndCatch(new PacketEvent.Receive(packet)) && !ci.isCancelled()) ci.cancel();
}

@Inject(method = {"sendPacket(Lnet/minecraft/network/Packet;)V"}, at = {@At("HEAD")}, cancellable = true)
private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
if (!ServerUtils.INSTANCE.handleSendPacket(packet))
if (postAndCatch(new PacketSentEvent(packet)) && !ci.isCancelled()) ci.cancel();
if (!ServerUtils.handleSendPacket(packet))
if (postAndCatch(new PacketEvent.Send(packet)) && !ci.isCancelled()) ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import java.nio.FloatBuffer;

import static org.lwjgl.opengl.GL11.*;

@Mixin(RenderEntityItem.class)
public abstract class MixinRenderEntityItem {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.odin.features.impl.floor7.p3

import me.odinmain.events.impl.BlockChangeEvent
import me.odinmain.events.impl.RealServerTick
import me.odinmain.events.impl.ServerTickEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.Setting.Companion.withDependency
Expand Down Expand Up @@ -117,7 +117,7 @@ object ArrowsDevice : Module(


@SubscribeEvent
fun onServerTick(event: RealServerTick) {
fun onServerTick(event: ServerTickEvent) {
serverTicksSinceLastTargetDisappeared = serverTicksSinceLastTargetDisappeared?.let {
// There was no target last tick (or the count would be null)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package me.odin.features.impl.render

import me.odin.mixin.accessors.IEntityPlayerSPAccessor
import me.odinmain.events.impl.PacketReceivedEvent
import me.odinmain.events.impl.PacketEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.Setting.Companion.withDependency
Expand Down Expand Up @@ -64,7 +64,7 @@ object EtherWarpHelper : Module(
}

@SubscribeEvent
fun onSoundPacket(event: PacketReceivedEvent) = with(event.packet) {
fun onSoundPacket(event: PacketEvent.Receive) = with(event.packet) {
if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !sounds || volume != 1f || pitch != 0.53968257f || customSound == "mob.enderdragon.hit") return
playLoudSound(if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound], soundVolume, soundPitch, positionVector)
event.isCanceled = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,4 @@ private void startDrawScreen(int mouseX, int mouseY, float partialTicks, Callbac
}
}
}

@Inject(method = "onGuiClosed", at = @At("HEAD"))
private void onGuiClosed(CallbackInfo ci) {
postAndCatch(new GuiEvent.Closed(odinMod$gui));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import me.odinmain.events.impl.GuiEvent;
import net.minecraft.client.gui.GuiScreen;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
Expand All @@ -18,21 +17,10 @@ public class MixinGuiScreen {
@Unique
private final GuiScreen odin$gui = (GuiScreen) (Object) this;

@Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "net/minecraft/client/gui/GuiScreen.mouseClicked(III)V"), cancellable = true)
private void onMouseInput(CallbackInfo ci){
if (Mouse.getEventButtonState())
if (postAndCatch(new GuiEvent.MouseClick(odin$gui, Mouse.getEventButton(), Mouse.getEventX(), Mouse.getEventY()))) ci.cancel();
}

@Inject(method = "handleMouseInput", at = @At(value = "INVOKE", target = "net/minecraft/client/gui/GuiScreen.mouseReleased(III)V"), cancellable = true)
private void onReleaseMouseInput(CallbackInfo ci){
if (!Mouse.getEventButtonState())
if (postAndCatch(new GuiEvent.GuiMouseReleaseEvent(odin$gui, Mouse.getEventButton(), Mouse.getEventX(), Mouse.getEventY()))) ci.cancel();
}

@Inject(method = "handleKeyboardInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;keyTyped(CI)V"), cancellable = true)
private void onHandleKeyboardInput(CallbackInfo ci) {
if (postAndCatch(new GuiEvent.KeyPress(odin$gui, Keyboard.getEventKey(), Keyboard.getEventCharacter()))) ci.cancel();
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import me.odinclient.features.impl.skyblock.CancelInteract;
import me.odinmain.events.impl.ClickEvent;
import me.odinmain.events.impl.PreKeyInputEvent;
import me.odinmain.events.impl.PreMouseInputEvent;
import me.odinmain.events.impl.InputEvent;
import me.odinmain.features.impl.render.CPSDisplay;
import me.odinmain.utils.skyblock.PlayerUtils;
import net.minecraft.client.Minecraft;
Expand All @@ -28,12 +27,12 @@ public class MixinMinecraft {

@Inject(method = {"runTick"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;dispatchKeypresses()V")})
public void keyPresses(CallbackInfo ci) {
if (Keyboard.getEventKeyState()) postAndCatch(new PreKeyInputEvent((Keyboard.getEventKey() == 0) ? (Keyboard.getEventCharacter() + 256) : Keyboard.getEventKey()));
if (Keyboard.getEventKeyState()) postAndCatch(new InputEvent.Keyboard((Keyboard.getEventKey() == 0) ? (Keyboard.getEventCharacter() + 256) : Keyboard.getEventKey()));
}

@Inject(method = {"runTick"}, at = {@At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventButton()I", remap = false)})
public void mouseKeyPresses(CallbackInfo ci) {
if (Mouse.getEventButtonState()) postAndCatch(new PreMouseInputEvent(Mouse.getEventButton()));
if (Mouse.getEventButtonState()) postAndCatch(new InputEvent.Mouse(Mouse.getEventButton()));
}

@Inject(method = {"runTick"}, at = {@At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;handleInput()V")})
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
package me.odinclient.mixin.mixins;

import io.netty.channel.ChannelHandlerContext;
import me.odinmain.events.impl.PacketReceivedEvent;
import me.odinmain.events.impl.PacketSentEvent;
import me.odinmain.events.impl.PacketEvent;
import me.odinmain.utils.ServerUtils;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
Expand All @@ -18,12 +17,12 @@ public class MixinNetworkManager {

@Inject(method = "channelRead0*", at = @At("HEAD"), cancellable = true)
private void onReceivePacket(ChannelHandlerContext context, Packet<?> packet, CallbackInfo ci) {
if (postAndCatch(new PacketReceivedEvent(packet)) && !ci.isCancelled()) ci.cancel();
if (postAndCatch(new PacketEvent.Receive(packet)) && !ci.isCancelled()) ci.cancel();
}

@Inject(method = {"sendPacket(Lnet/minecraft/network/Packet;)V"}, at = {@At("HEAD")}, cancellable = true)
private void onSendPacket(Packet<?> packet, CallbackInfo ci) {
if (!ServerUtils.INSTANCE.handleSendPacket(packet))
if (postAndCatch(new PacketSentEvent(packet)) && !ci.isCancelled()) ci.cancel();
if (!ServerUtils.handleSendPacket(packet))
if (postAndCatch(new PacketEvent.Send(packet)) && !ci.isCancelled()) ci.cancel();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

import java.nio.FloatBuffer;

import static org.lwjgl.opengl.GL11.*;

@Mixin(RenderEntityItem.class)
public abstract class MixinRenderEntityItem {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ object AutoGFS : Module(
private val refillOnDungeonStart by BooleanSetting("Refill on Dungeon Start", true, description = "Refill when a dungeon starts.")
private val refillPearl by BooleanSetting("Refill Pearl", true, description = "Refill ender pearls.")
private val refillJerry by BooleanSetting("Refill Jerry", true, description = "Refill inflatable jerrys.")
private val refillTNT by BooleanSetting("Refill TNT", true, description = "Refill superboom tnt.")
private val refillOnTimer by BooleanSetting("Refill on Timer", true, description = "Refill on a 5s intervals.")
private val timerIncrements by NumberSetting("Timer Increments", 5L, 1, 60, description = "The interval in which to refill.", unit = "s")

Expand All @@ -40,6 +41,6 @@ object AutoGFS : Module(

inventory.find { it?.skyblockID == "INFLATABLE_JERRY" }?.takeIf { refillJerry }?.also { fillItemFromSack(64, "INFLATABLE_JERRY", "inflatable_jerry", false) }

inventory.find { it?.skyblockID == "SUPERBOOM_TNT" }.takeIf { it?.stackSize == 1 }?.also { fillItemFromSack(1, "SUPERBOOM_TNT", "superboom_tnt", false) }
inventory.find { it?.skyblockID == "SUPERBOOM_TNT" }.takeIf { refillTNT }?.also { fillItemFromSack(1, "SUPERBOOM_TNT", "superboom_tnt", false) }
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package me.odinclient.features.impl.dungeon

import me.odinmain.events.impl.GuiEvent
import me.odinmain.events.impl.PacketReceivedEvent
import me.odinmain.events.impl.PacketEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.impl.SelectorSetting
Expand All @@ -13,7 +12,9 @@ import net.minecraft.client.gui.inventory.GuiChest
import net.minecraft.inventory.ContainerChest
import net.minecraft.network.play.client.C0DPacketCloseWindow
import net.minecraft.network.play.server.S2DPacketOpenWindow
import net.minecraftforge.client.event.GuiScreenEvent
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import org.lwjgl.input.Mouse

object CloseChest : Module(
name = "Close Chest",
Expand All @@ -23,25 +24,25 @@ object CloseChest : Module(
private val mode by SelectorSetting("Mode", "Auto", arrayListOf("Auto", "Any Key"), description = "The mode to use, auto will automatically close the chest, any key will make any key input close the chest.")

@SubscribeEvent
fun onOpenWindow(event: PacketReceivedEvent) {
fun onOpenWindow(event: PacketEvent.Receive) {
val packet = event.packet as? S2DPacketOpenWindow ?: return
if (!inDungeons || !packet.windowTitle.unformattedText.noControlCodes.equalsOneOf("Chest", "Large Chest") || mode == 0) return
mc.netHandler.networkManager.sendPacket(C0DPacketCloseWindow(packet.windowId))
event.isCanceled = true
}

@SubscribeEvent
fun onInput(event: GuiEvent.KeyPress) {
fun onInput(event: GuiScreenEvent.KeyboardInputEvent.Pre) {
val gui = event.gui as? GuiChest ?: return
if (!inDungeons || mode != 1) return
if ((gui.inventorySlots as? ContainerChest)?.name?.noControlCodes?.equalsOneOf("Chest", "Large Chest") == true)
mc.thePlayer?.closeScreen()
}

@SubscribeEvent
fun onMouse(event: GuiEvent.MouseClick) {
fun onMouse(event: GuiScreenEvent.MouseInputEvent.Pre) {
val gui = event.gui as? GuiChest ?: return
if (!inDungeons || mode != 1) return
if (!inDungeons || mode != 1 || !Mouse.getEventButtonState()) return
if ((gui.inventorySlots as? ContainerChest)?.name?.noControlCodes?.equalsOneOf("Chest", "Large Chest") == true)
mc.thePlayer?.closeScreen()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package me.odinclient.features.impl.floor7.p3

import me.odinclient.utils.skyblock.PlayerUtils.rightClick
import me.odinmain.events.impl.BlockChangeEvent
import me.odinmain.events.impl.RealServerTick
import me.odinmain.events.impl.ServerTickEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.Setting.Companion.withDependency
Expand Down Expand Up @@ -361,7 +361,7 @@ object ArrowsDevice : Module(


@SubscribeEvent
fun onServerTick(event: RealServerTick) {
fun onServerTick(event: ServerTickEvent) {
serverTicksSinceLastTargetDisappeared = serverTicksSinceLastTargetDisappeared?.let {
// There was no target last tick (or the count would be null)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.odinclient.features.impl.floor7.p3

import me.odinmain.events.impl.PacketSentEvent
import me.odinmain.events.impl.PacketEvent
import me.odinmain.events.impl.PostEntityMetadata
import me.odinmain.features.Category
import me.odinmain.features.Module
Expand Down Expand Up @@ -49,7 +49,7 @@ object TerminalAura : Module(
}

@SubscribeEvent
fun onPacketSent(event: PacketSentEvent) {
fun onPacketSent(event: PacketEvent.Send) {
(event.packet as? C02PacketUseEntity)?.getEntityFromWorld(mc.theWorld)?.let {
if (it.name.noControlCodes != "Inactive Terminal") return
if (!interactClock.hasTimePassed() || TerminalSolver.currentTerm.type != TerminalTypes.NONE) event.isCanceled = true else interactClock.update()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package me.odinclient.features.impl.render
import me.odinclient.mixin.accessors.IEntityPlayerSPAccessor
import me.odinclient.utils.skyblock.PlayerUtils
import me.odinmain.events.impl.ClickEvent
import me.odinmain.events.impl.PacketReceivedEvent
import me.odinmain.events.impl.PacketEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.impl.dungeon.dungeonwaypoints.DungeonWaypoints.toBlockPos
Expand Down Expand Up @@ -130,7 +130,7 @@ object EtherWarpHelper : Module(
}

@SubscribeEvent
fun onSoundPacket(event: PacketReceivedEvent) = with(event.packet) {
fun onSoundPacket(event: PacketEvent.Receive) = with(event.packet) {
if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !sounds || volume != 1f || pitch != 0.53968257f || customSound == "mob.enderdragon.hit") return
playLoudSound(if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound], soundVolume, soundPitch, positionVector)
event.isCanceled = true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package me.odinclient.features.impl.render

import me.odinmain.events.impl.PacketReceivedEvent
import me.odinmain.events.impl.PacketEvent
import me.odinmain.features.Category
import me.odinmain.features.Module
import me.odinmain.features.settings.impl.BooleanSetting
Expand All @@ -24,7 +24,7 @@ object NoDebuff : Module(
private val antiWaterFOV by BooleanSetting("No Water FOV", false, description = "Disable FOV change in water.")
private val noFire by BooleanSetting("No Fire Overlay", false, description = "Disable Fire overlay on screen.")
private val seeThroughBlocks by BooleanSetting("See Through Blocks", false, description = "Makes blocks transparent.")
private val noNausea by BooleanSetting("No Nausea", false, description = "Disables nausea effect.")
private val noNausea by BooleanSetting("No Nausea", false, description = "Disables the nausea effect.")

@JvmStatic
val shouldIgnoreNausea get() = noNausea && enabled
Expand All @@ -46,7 +46,7 @@ object NoDebuff : Module(
}

@SubscribeEvent
fun onPacket(event: PacketReceivedEvent) {
fun onPacket(event: PacketEvent.Receive) {
val packet = event.packet as? S2APacketParticles ?: return
if (noShieldParticles && packet.particleType.equalsOneOf(EnumParticleTypes.SPELL_WITCH, EnumParticleTypes.HEART))
event.isCanceled = true
Expand Down
Loading

0 comments on commit 2a00bb0

Please sign in to comment.