-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #557 from rfresh2/packetlogger
PacketLogger Revamp
- Loading branch information
Showing
13 changed files
with
1,823 additions
and
582 deletions.
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
src/main/java/com/lambda/mixin/accessor/network/AccessorCPacketClientSettings.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,12 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.client.CPacketClientSettings; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = CPacketClientSettings.class) | ||
public interface AccessorCPacketClientSettings { | ||
@Accessor(value = "view") | ||
int getView(); | ||
|
||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/lambda/mixin/accessor/network/AccessorCPacketConfirmTransaction.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,11 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.client.CPacketConfirmTransaction; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = CPacketConfirmTransaction.class) | ||
public interface AccessorCPacketConfirmTransaction { | ||
@Accessor(value = "accepted") | ||
boolean getAccepted(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/lambda/mixin/accessor/network/AccessorCPacketPlayerAbilities.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,13 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.client.CPacketPlayerAbilities; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = CPacketPlayerAbilities.class) | ||
public interface AccessorCPacketPlayerAbilities { | ||
@Accessor(value = "flySpeed") | ||
float getFlySpeed(); | ||
@Accessor(value = "walkSpeed") | ||
float getWalkSpeed(); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/lambda/mixin/accessor/network/AccessorCPacketResourcePackStatus.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,11 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.client.CPacketResourcePackStatus; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = CPacketResourcePackStatus.class) | ||
public interface AccessorCPacketResourcePackStatus { | ||
@Accessor(value = "action") | ||
CPacketResourcePackStatus.Action getAction(); | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/java/com/lambda/mixin/accessor/network/AccessorCPacketSpectate.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,13 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.client.CPacketSpectate; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
import java.util.UUID; | ||
|
||
@Mixin(value = CPacketSpectate.class) | ||
public interface AccessorCPacketSpectate { | ||
@Accessor(value = "id") | ||
UUID getId(); | ||
} |
11 changes: 11 additions & 0 deletions
11
src/main/java/com/lambda/mixin/accessor/network/AccessorSPacketCloseWindow.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,11 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.server.SPacketCloseWindow; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = SPacketCloseWindow.class) | ||
public interface AccessorSPacketCloseWindow { | ||
@Accessor(value = "windowId") | ||
int getWindowId(); | ||
} |
26 changes: 26 additions & 0 deletions
26
src/main/java/com/lambda/mixin/accessor/network/AccessorSPacketMaps.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,26 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.server.SPacketMaps; | ||
import net.minecraft.world.storage.MapDecoration; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = SPacketMaps.class) | ||
public interface AccessorSPacketMaps { | ||
@Accessor(value = "mapScale") | ||
byte getMapScale(); | ||
@Accessor(value = "trackingPosition") | ||
boolean getTrackingPosition(); | ||
@Accessor(value = "icons") | ||
MapDecoration[] getIcons(); | ||
@Accessor(value = "minX") | ||
int getMinX(); | ||
@Accessor(value = "minZ") | ||
int getMinZ(); | ||
@Accessor(value = "columns") | ||
int getColumns(); | ||
@Accessor(value = "rows") | ||
int getRows(); | ||
@Accessor(value = "mapDataBytes") | ||
byte[] getMapDataBytes(); | ||
} |
27 changes: 27 additions & 0 deletions
27
src/main/java/com/lambda/mixin/accessor/network/AccessorSPacketWorldBorder.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,27 @@ | ||
package com.lambda.mixin.accessor.network; | ||
|
||
import net.minecraft.network.play.server.SPacketWorldBorder; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.gen.Accessor; | ||
|
||
@Mixin(value = SPacketWorldBorder.class) | ||
public interface AccessorSPacketWorldBorder { | ||
@Accessor(value = "action") | ||
SPacketWorldBorder.Action getAction(); | ||
@Accessor(value = "size") | ||
int getSize(); | ||
@Accessor(value = "centerX") | ||
double getCenterX(); | ||
@Accessor(value = "centerZ") | ||
double getCenterZ(); | ||
@Accessor(value = "targetSize") | ||
double getTargetSize(); | ||
@Accessor(value = "diameter") | ||
double getDiameter(); | ||
@Accessor(value = "timeUntilTarget") | ||
long getTimeUntilTarget(); | ||
@Accessor(value = "warningTime") | ||
int getWarningTime(); | ||
@Accessor(value = "warningDistance") | ||
int getWarningDistance(); | ||
} |
60 changes: 60 additions & 0 deletions
60
src/main/kotlin/com/lambda/client/gui/hudgui/elements/misc/PacketLogViewer.kt
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,60 @@ | ||
package com.lambda.client.gui.hudgui.elements.misc | ||
|
||
import com.lambda.client.event.SafeClientEvent | ||
import com.lambda.client.gui.hudgui.LabelHud | ||
import com.lambda.client.module.modules.player.PacketLogger | ||
import java.util.* | ||
|
||
internal object PacketLogViewer: LabelHud( | ||
name = "PacketLogViewer", | ||
category = Category.MISC, | ||
description = "Displays the packet log" | ||
) { | ||
|
||
private val maxLines by setting("Max Lines", 50, 1..200, 1) | ||
private val logs: MutableList<String> = Collections.synchronizedList(mutableListOf()) | ||
private val onlyWhenLoggerEnabled by setting("Only When Logger Enabled", true) | ||
private val clearButton by setting("Clear", false, consumer = { _, _ -> | ||
clear() | ||
false | ||
}) | ||
|
||
init { | ||
visibleSetting.valueListeners.add { _, it -> | ||
if (!it) { | ||
clear() | ||
} | ||
} | ||
} | ||
|
||
override fun SafeClientEvent.updateText() { | ||
displayText.clear() | ||
if (onlyWhenLoggerEnabled && PacketLogger.isDisabled) return | ||
if (logs.isNotEmpty() && (PacketLogger.logMode == PacketLogger.LogMode.ALL || PacketLogger.logMode == PacketLogger.LogMode.ONLY_HUD)) { | ||
displayText.addLine("PacketLog Viewer", secondaryColor) | ||
synchronized(logs) { | ||
logs.forEach { log -> | ||
log.split(",").forEachIndexed { i, s -> | ||
displayText.add(s, if (i % 2 == 0) secondaryColor else primaryColor) | ||
} | ||
displayText.addLine("") | ||
} | ||
} | ||
} | ||
} | ||
|
||
fun addPacketLog(log: String) { | ||
synchronized(logs) { | ||
logs.add(log) | ||
if (logs.size > maxLines) { | ||
logs.removeAt(0) | ||
} | ||
} | ||
} | ||
|
||
fun clear() { | ||
synchronized(logs) { | ||
logs.clear() | ||
} | ||
} | ||
} |
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
Oops, something went wrong.