diff options
author | Lorenz <lo.scherf@gmail.com> | 2022-08-22 02:32:27 +0200 |
---|---|---|
committer | Lorenz <lo.scherf@gmail.com> | 2022-08-22 02:32:27 +0200 |
commit | 1021280302d684071a9bde3cf274a16913eb48ec (patch) | |
tree | 43acec5e4ef3eab725ef11ee3ad39dfe673cf8a5 /src/main/java/at/hannibal2/skyhanni/test/command | |
parent | ad946bccdb1dd666f2648434ed3653eaf0b137a1 (diff) | |
download | skyhanni-1021280302d684071a9bde3cf274a16913eb48ec.tar.gz skyhanni-1021280302d684071a9bde3cf274a16913eb48ec.tar.bz2 skyhanni-1021280302d684071a9bde3cf274a16913eb48ec.zip |
removed /ii and created /copyitem
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni/test/command')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt | 48 | ||||
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt | 104 |
2 files changed, 152 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt new file mode 100644 index 000000000..854ab26eb --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyItemCommand.kt @@ -0,0 +1,48 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.config.gui.utils.Utils +import at.hannibal2.skyhanni.test.LorenzTest +import at.hannibal2.skyhanni.utils.ItemUtils.getInternalName +import at.hannibal2.skyhanni.utils.ItemUtils.getLore +import at.hannibal2.skyhanni.utils.LorenzUtils +import net.minecraft.client.Minecraft + +object CopyItemCommand { + + fun command(args: Array<String>) { + try { + val resultList = mutableListOf<String>() + val itemStack = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem()!! + resultList.add("ITEM LORE") + resultList.add("display name: '" + itemStack.displayName.toString() + "'") + val itemID = itemStack.getInternalName() + resultList.add("internalName: '$itemID'") + resultList.add("") + for (line in itemStack.getLore()) { + resultList.add("'$line'") + println(line) + } + resultList.add("") + resultList.add("getTagCompound") + if (itemStack.hasTagCompound()) { + val tagCompound = itemStack.tagCompound + for (s in tagCompound.keySet) { + resultList.add(" '$s'") + } + if (tagCompound.hasKey("ExtraAttributes")) { + resultList.add("") + resultList.add("ExtraAttributes") + val extraAttributes = tagCompound.getCompoundTag("ExtraAttributes") + LorenzTest.runn(extraAttributes, " . ") + } + } + + val string = resultList.joinToString("\n") + Utils.copyToClipboard(string) + LorenzUtils.debug("item info printed!") + LorenzUtils.chat("§e[SkyHanni] item info copied into the clipboard!") + } catch (_: Throwable) { + LorenzUtils.chat("§c[SkyHanni] No item in hand!") + } + } +}
\ No newline at end of file diff --git a/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt new file mode 100644 index 000000000..c5a05d94a --- /dev/null +++ b/src/main/java/at/hannibal2/skyhanni/test/command/CopyNearbyEntitiesCommand.kt @@ -0,0 +1,104 @@ +package at.hannibal2.skyhanni.test.command + +import at.hannibal2.skyhanni.config.gui.utils.Utils +import at.hannibal2.skyhanni.utils.ItemUtils.cleanName +import at.hannibal2.skyhanni.utils.ItemUtils.getSkullTexture +import at.hannibal2.skyhanni.utils.LocationUtils +import at.hannibal2.skyhanni.utils.LorenzUtils +import at.hannibal2.skyhanni.utils.LorenzUtils.baseMaxHealth +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.monster.EntityMagmaCube + +object CopyNearbyEntitiesCommand { + + fun command(args: Array<String>) { + var searchRadius = 10 + if (args.size == 1) { + searchRadius = args[0].toInt() + } + + val minecraft = Minecraft.getMinecraft() + val start = LocationUtils.playerLocation() + val world = minecraft.theWorld + + val resultList = mutableListOf<String>() + var counter = 0 + + for (entity in world.loadedEntityList) { + val position = entity.position + val vec = position.toLorenzVec() + val distance = start.distance(vec) + if (distance < searchRadius) { + resultList.add("found entity: '" + entity.name + "'") + val displayName = entity.displayName + resultList.add("displayName: '${displayName.formattedText}'") + val simpleName = entity.javaClass.simpleName + resultList.add("simpleName: $simpleName") + resultList.add("vec: $vec") + resultList.add("distance: $distance") + + val rotationYaw = entity.rotationYaw + val rotationPitch = entity.rotationPitch + resultList.add("rotationYaw: $rotationYaw") + resultList.add("rotationPitch: $rotationPitch") + + val riddenByEntity = entity.riddenByEntity + resultList.add("riddenByEntity: $riddenByEntity") + val ridingEntity = entity.ridingEntity + 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") + + } + } + } else { + if (entity is EntityLivingBase) { + val baseMaxHealth = entity.baseMaxHealth + val health = entity.health.toInt() + resultList.add("baseMaxHealth: $baseMaxHealth") + resultList.add("health: $health") + } + if (entity is EntityMagmaCube) { + val squishFactor = entity.squishFactor + val slimeSize = entity.slimeSize + resultList.add("factor: $squishFactor") + resultList.add("slimeSize: $slimeSize") + + } + } + resultList.add("") + resultList.add("") + counter++ + } + } + + if (counter != 0) { + val string = resultList.joinToString("\n") + Utils.copyToClipboard(string) + LorenzUtils.chat("§e[SkyHanni] $counter entities copied into the clipboard!") + } else { + LorenzUtils.chat("§e[SkyHanni] No entities found in a search radius of $searchRadius!") + } + } +}
\ No newline at end of file |