[fix] Pyro Client bug

Closes #1649

Signed-off-by: Dominika <sokolov.dominika@gmail.com>
This commit is contained in:
Dominika 2020-11-29 16:55:09 -05:00
parent 0ead2f23eb
commit 60d1e841a9
No known key found for this signature in database
GPG Key ID: B4A5A6DCA70F861F
1 changed files with 4 additions and 1 deletions

View File

@ -22,6 +22,7 @@ object FakePlayer : Module() {
val playerName = register(Settings.stringBuilder("PlayerName").withValue("Player").withVisibility { false })
private var fakePlayer: EntityOtherPlayerMP? = null
private const val ENTITY_ID = -7170400
init {
listener<ConnectionEvent.Disconnect> {
@ -38,6 +39,7 @@ object FakePlayer : Module() {
disable()
return
}
if (playerName.value == "Player") {
MessageSendHelper.sendChatMessage("You can use &7'${Command.commandPrefix.value}fp <name>'&r to set a custom name")
}
@ -47,12 +49,13 @@ object FakePlayer : Module() {
rotationYawHead = mc.player.rotationYawHead
if (copyInventory.value) inventory.copyInventory(mc.player.inventory)
}.also {
mc.world.addEntityToWorld(-911, it)
mc.world.addEntityToWorld(ENTITY_ID, it)
}
}
override fun onDisable() {
if (mc.world == null || mc.player == null) return
fakePlayer?.setDead()
mc.world?.removeEntityFromWorld(ENTITY_ID)
}
}