Skip to content

Commit

Permalink
Fixed AutoLog triggered by fake player, changed entrypoint (main -> c…
Browse files Browse the repository at this point in the history
…lient)
  • Loading branch information
ya-ilya committed Sep 10, 2023
1 parent 4d58fb2 commit 30994e6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions progreso-client/src/main/kotlin/org/progreso/client/Client.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.progreso.client

import net.fabricmc.api.ModInitializer
import net.fabricmc.api.ClientModInitializer
import net.fabricmc.loader.api.FabricLoader
import net.minecraft.client.MinecraftClient
import net.minecraft.client.gui.screen.Screen
Expand All @@ -21,7 +21,7 @@ import org.progreso.client.util.client.KeyboardUtil
import org.reflections.Reflections
import org.slf4j.LoggerFactory

class Client : ModInitializer {
class Client : ClientModInitializer {
companion object {
@JvmStatic
val mc by lazy { MinecraftClientWrapper(MinecraftClient.getInstance()) }
Expand All @@ -35,7 +35,7 @@ class Client : ModInitializer {
val config get() = ProgresoGlobalConfigAccessor.config
}

override fun onInitialize() {
override fun onInitializeClient() {
Api.accessors(
EventAccessor,
ChatAccessor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.progreso.api.module.AbstractModule
import org.progreso.client.Client.Companion.mc
import org.progreso.client.events.misc.TickEvent
import org.progreso.client.events.safeEventListener
import org.progreso.client.modules.misc.FakePlayer

@AbstractModule.AutoRegister
object AutoLog : AbstractModule() {
Expand All @@ -20,7 +21,7 @@ object AutoLog : AbstractModule() {
if (range) {
val playersInRange = mc.world.players
.filter { mc.player.distanceTo(it) <= rangeValue }
.filter { mc.player != it }
.filter { mc.player != it && FakePlayer.fakePlayer != it }
.map { it.name.string }

if (playersInRange.isNotEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import java.util.*
@AbstractModule.AutoRegister
object FakePlayer : AbstractModule() {
private val fakePlayerName by setting("Name", "FakePlayer")
private var fakePlayer: OtherClientPlayerEntity? = null

var fakePlayer: OtherClientPlayerEntity? = null

init {
onEnable {
Expand Down
2 changes: 1 addition & 1 deletion progreso-client/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"environment": "client",
"entrypoints": {
"main": [
"client": [
"org.progreso.client.Client"
]
},
Expand Down

0 comments on commit 30994e6

Please sign in to comment.