From cfeac0b6a71c592b61c53fad192eb22bb24b0f54 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Wed, 7 Sep 2022 05:09:48 +0200 Subject: 0.7 (#2) * code cleanup * Option to hide the Skyblock Level from the chat messages, Option to change the way the Skyblock Level gets displayed in the chat * change version to 0.6.1 * add highlight the voidling extremist in pink color * add highlight corrupted mobs in purple color * fixed highlight corrupted mobs in purple color in the private island * another minor fix for highlight corrupted mobs in purple color * created EntityHealthUpdateEvent and fixing CorruptedMobHighlight * using EntityHealthUpdateEvent everywhere * added marking a player with yellow color * highlight slayer miniboss in blue color * /copyentities now shows health correctly for every entity * infer fix * fixing bazaar message filter * changelog * hides the death messages of other players, except for players who are close to the player. * hiding tip messages * highlight deathmites in dungeon in red color * code cleanup * code cleanup * hide tnt laying around in dungeon * fix infer * remove debug * Added hide Blessings laying around in dungeon. Added hide Revive Stones laying around in dungeon. * Hide Premium Flesh laying around in dungeon. * edited LorenzTest * Added dungeon copilot and separate filter for hiding dungeon key and door messages. * Added hide Journal Entry pages laying around in dungeon. * Added hide Skeleton Skulls laying around in dungeon. * credits * Added highlight Skeleton Skulls when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) * Added highlight Skeleton Skulls when combining into a skeleton in orange color (not useful combined with feature Hide Skeleton Skull) * fix wording * clarification * small fixes * Highlight the enderman slayer Yang Glyph (Beacon) in red color (supports beacon in hand and beacon flying) * better/more readability for CopyNearbyEntitiesCommand * make version 0.7 --- .../hannibal2/skyhanni/test/GriffinJavaUtils.java | 3 +- .../java/at/hannibal2/skyhanni/test/LorenzTest.kt | 94 +++++++++++------ .../test/command/CopyNearbyEntitiesCommand.kt | 116 ++++++++++++++------- 3 files changed, 141 insertions(+), 72 deletions(-) (limited to 'src/main/java/at/hannibal2/skyhanni/test') diff --git a/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java b/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java index 431cfbe6f..688923f65 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java +++ b/src/main/java/at/hannibal2/skyhanni/test/GriffinJavaUtils.java @@ -15,10 +15,11 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.text.DecimalFormat; -import java.util.*; import java.util.List; +import java.util.*; import java.util.function.Function; +//TODO delte this class after next diana mayor public class GriffinJavaUtils { public static void permute(ArrayList> result, T[] a, int k) { if (k == a.length) { diff --git a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt index 851a8c207..416034a97 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/LorenzTest.kt @@ -7,8 +7,6 @@ import at.hannibal2.skyhanni.utils.LorenzLogger import at.hannibal2.skyhanni.utils.RenderUtils.renderString import net.minecraft.nbt.NBTTagCompound import net.minecraft.network.play.server.S0EPacketSpawnObject -import net.minecraft.network.play.server.S0FPacketSpawnMob -import net.minecraft.network.play.server.S1CPacketEntityMetadata import net.minecraftforge.client.event.RenderGameOverlayEvent import net.minecraftforge.fml.common.eventhandler.EventPriority import net.minecraftforge.fml.common.eventhandler.SubscribeEvent @@ -18,10 +16,14 @@ class LorenzTest { var packetLog = LorenzLogger("debug/packets") companion object { - var enabled = false - var togglePacketLog = false + private var shouldLogPackets = false var text = "" + // var a = 127.0 + var a = 2.0 + var b = 0.0 + var c = 0.0 + val debugLogger = LorenzLogger("debug/test") fun runn(compound: NBTTagCompound, text: String) { @@ -37,6 +39,11 @@ class LorenzTest { } fun testCommand(args: Array) { + + a = args[0].toDouble() + b = args[1].toDouble() + c = args[2].toDouble() + // togglePacketLog = !togglePacketLog // for (line in (Minecraft.getMinecraft().ingameGUI.tabList as AccessorGuiPlayerTabOverlay).footer.unformattedText @@ -49,51 +56,72 @@ class LorenzTest { // println("tablist: '$line'") // } } + + fun togglePacketLog() { + shouldLogPackets = !shouldLogPackets + } } @SubscribeEvent fun renderOverlay(event: RenderGameOverlayEvent.Post) { if (!SkyHanniMod.feature.debug.enabled) return - if (enabled) { - SkyHanniMod.feature.debug.testPos.renderString(text) - } + SkyHanniMod.feature.debug.testPos.renderString(text) } @SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true) fun onChatPacket(event: PacketEvent.ReceiveEvent) { val packet = event.packet val name = packet.javaClass.simpleName - if (!togglePacketLog) return + if (!shouldLogPackets) return packetLog.log(name) - if (packet is S0FPacketSpawnMob) { - packetLog.log("") - packetLog.log("Spawn Mob!") - for (watchableObject in packet.func_149027_c()) { - val any = watchableObject.`object` - val simpleName = any.javaClass.simpleName +// if (packet is S18PacketEntityTeleport) { +// val entityId = packet.entityId +// packetLog.log("entityId: $entityId") +// val entity = Minecraft.getMinecraft().theWorld.loadedEntityList.find { it.entityId == entityId } +// val className = entity?.javaClass?.name ?: "null" +// packetLog.log("className: $className") +// +// if (Minecraft.getMinecraft().thePlayer.isSneaking) { +// if (entity is EntityArmorStand) { +// event.isCanceled = true +// } +// } +// } + + +// if (packet is S0FPacketSpawnMob) { +// packetLog.log("") +// packetLog.log("Spawn Mob!") +// for (watchableObject in packet.func_149027_c()) { +// val any = watchableObject.`object` +// val simpleName = any.javaClass.simpleName +// +// packetLog.log("javaClass: $simpleName") +// packetLog.log("object: $any") +// packetLog.log(" ") +// } +// packetLog.log(" ") +// } + + +// if (packet is S1CPacketEntityMetadata) { +// packetLog.log("") +// packetLog.log("Entity Metadata") +// for (watchableObject in packet.func_149376_c()) { +// val any = watchableObject.`object` +// val simpleName = any.javaClass.simpleName +// +// packetLog.log("javaClass: $simpleName") +// packetLog.log("object: $any") +// packetLog.log(" ") +// } +// packetLog.log(" ") +// } + - packetLog.log("javaClass: $simpleName") - packetLog.log("object: $any") - packetLog.log(" ") - } - packetLog.log(" ") - } - if (packet is S1CPacketEntityMetadata) { - packetLog.log("") - packetLog.log("Entity Metadata") - for (watchableObject in packet.func_149376_c()) { - val any = watchableObject.`object` - val simpleName = any.javaClass.simpleName - - packetLog.log("javaClass: $simpleName") - packetLog.log("object: $any") - packetLog.log(" ") - } - packetLog.log(" ") - } // if (packet is S20PacketEntityProperties) { // packetLog.log("") // packetLog.log("Entity Properties") diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt index 291000c77..1467f2b85 100644 --- a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt @@ -2,6 +2,7 @@ package at.hannibal2.skyhanni.test.command import at.hannibal2.skyhanni.utils.ItemUtils.cleanName import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.ItemUtils.name import at.hannibal2.skyhanni.utils.LocationUtils import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth @@ -10,8 +11,10 @@ import at.hannibal2.skyhanni.utils.toLorenzVec import net.minecraft.client.Minecraft import net.minecraft.entity.EntityLivingBase import net.minecraft.entity.item.EntityArmorStand +import net.minecraft.entity.item.EntityItem import net.minecraft.entity.monster.EntityEnderman import net.minecraft.entity.monster.EntityMagmaCube +import net.minecraft.item.ItemStack object CopyNearbyEntitiesCommand { @@ -33,18 +36,19 @@ object CopyNearbyEntitiesCommand { val vec = position.toLorenzVec() val distance = start.distance(vec) if (distance < searchRadius) { - resultList.add("found entity: '" + entity.name + "'") + val simpleName = entity.javaClass.simpleName + resultList.add("entity: $simpleName") val displayName = entity.displayName + resultList.add("name: '" + entity.name + "'") resultList.add("displayName: '${displayName.formattedText}'") - val simpleName = entity.javaClass.simpleName - resultList.add("simpleName: $simpleName") - resultList.add("vec: $vec") - resultList.add("distance: $distance") + resultList.add("location data:") + resultList.add("- vec: $vec") + resultList.add("- distance: $distance") val rotationYaw = entity.rotationYaw val rotationPitch = entity.rotationPitch - resultList.add("rotationYaw: $rotationYaw") - resultList.add("rotationPitch: $rotationPitch") + resultList.add("- rotationYaw: $rotationYaw") + resultList.add("- rotationPitch: $rotationPitch") val riddenByEntity = entity.riddenByEntity resultList.add("riddenByEntity: $riddenByEntity") @@ -52,46 +56,66 @@ object CopyNearbyEntitiesCommand { resultList.add("ridingEntity: $ridingEntity") - if (entity is EntityArmorStand) { - resultList.add("armor stand data:") - val headRotation = entity.headRotation.toLorenzVec() - val bodyRotation = entity.bodyRotation.toLorenzVec() - resultList.add("headRotation: $headRotation") - resultList.add("bodyRotation: $bodyRotation") - - for ((id, stack) in entity.inventory.withIndex()) { - resultList.add("id $id = $stack") - if (stack != null) { - val skullTexture = stack.getSkullTexture() - if (skullTexture != null) { - resultList.add("skullTexture: $skullTexture") - } - val cleanName = stack.cleanName() - val type = stack.javaClass.name - resultList.add("cleanName: $cleanName") - resultList.add("type: $type") + when (entity) { + is EntityArmorStand -> { + resultList.add("EntityArmorStand:") + val headRotation = entity.headRotation.toLorenzVec() + val bodyRotation = entity.bodyRotation.toLorenzVec() + resultList.add("- headRotation: $headRotation") + resultList.add("- bodyRotation: $bodyRotation") + resultList.add("- inventory:") + for ((id, stack) in entity.inventory.withIndex()) { + resultList.add("- id $id ($stack)") + printItemStackData(stack, resultList) } } - } else if (entity is EntityEnderman) { - val enderman = entity as EntityEnderman - val heldItem = enderman.heldItem - resultList.add("enderman heldItem: $heldItem") - } else { - if (entity is EntityLivingBase) { - val baseMaxHealth = entity.baseMaxHealth - val health = entity.health.toInt() - resultList.add("baseMaxHealth: $baseMaxHealth") - resultList.add("health: $health") + + is EntityEnderman -> { + resultList.add("EntityEnderman:") + val heldBlockState = entity.heldBlockState + resultList.add("- heldBlockState: $heldBlockState") + if (heldBlockState != null) { + val block = heldBlockState.block + resultList.add("- block: $block") + } } - if (entity is EntityMagmaCube) { + + is EntityMagmaCube -> { + resultList.add("EntityMagmaCube:") val squishFactor = entity.squishFactor val slimeSize = entity.slimeSize - resultList.add("factor: $squishFactor") - resultList.add("slimeSize: $slimeSize") + resultList.add("- factor: $squishFactor") + resultList.add("- slimeSize: $slimeSize") + } + + is EntityItem -> { + resultList.add("EntityItem:") + val stack = entity.entityItem + val stackName = stack.name + val stackDisplayName = stack.displayName + val cleanName = stack.cleanName() + val itemEnchanted = stack.isItemEnchanted + val itemDamage = stack.itemDamage + val stackSize = stack.stackSize + val maxStackSize = stack.maxStackSize + resultList.add("- name: '$stackName'") + resultList.add("- stackDisplayName: '$stackDisplayName'") + resultList.add("- cleanName: '$cleanName'") + resultList.add("- itemEnchanted: '$itemEnchanted'") + resultList.add("- itemDamage: '$itemDamage'") + resultList.add("- stackSize: '$stackSize'") + resultList.add("- maxStackSize: '$maxStackSize'") } } + if (entity is EntityLivingBase) { + resultList.add("EntityLivingBase:") + val baseMaxHealth = entity.baseMaxHealth.toInt() + val health = entity.health.toInt() + resultList.add("- baseMaxHealth: $baseMaxHealth") + resultList.add("- health: $health") + } resultList.add("") resultList.add("") counter++ @@ -106,4 +130,20 @@ object CopyNearbyEntitiesCommand { LorenzUtils.chat("§e[SkyHanni] No entities found in a search radius of $searchRadius!") } } + + private fun printItemStackData(stack: ItemStack?, resultList: MutableList) { + if (stack != null) { + val skullTexture = stack.getSkullTexture() + if (skullTexture != null) { + resultList.add("- skullTexture:") + resultList.add("- $skullTexture") + } + val cleanName = stack.cleanName() + val stackName = stack.name + val type = stack.javaClass.name + resultList.add("- name: '$stackName'") + resultList.add("- cleanName: '$cleanName'") + resultList.add("- type: $type") + } + } } \ No newline at end of file -- cgit