aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin')
-rw-r--r--src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt
index 9e29d248..e083cd06 100644
--- a/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt
+++ b/src/main/kotlin/io/github/moulberry/notenoughupdates/commands/dev/PackDevCommand.kt
@@ -26,6 +26,7 @@ import io.github.moulberry.notenoughupdates.autosubscribe.NEUAutoSubscribe
import io.github.moulberry.notenoughupdates.core.util.MiscUtils
import io.github.moulberry.notenoughupdates.events.RegisterBrigadierCommandEvent
import io.github.moulberry.notenoughupdates.util.brigadier.*
+import net.minecraft.block.state.IBlockState
import net.minecraft.client.Minecraft
import net.minecraft.client.entity.AbstractClientPlayer
import net.minecraft.command.ICommandSender
@@ -35,8 +36,11 @@ import net.minecraft.entity.EntityLivingBase
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.entity.player.EntityPlayer
import net.minecraft.item.ItemStack
+import net.minecraft.tileentity.TileEntitySkull
import net.minecraft.util.EnumChatFormatting
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.*
+
@NEUAutoSubscribe
class PackDevCommand {
@@ -152,6 +156,31 @@ class PackDevCommand {
npcListCommand("armor stand", "getarmorstand", "getarmorstands", EntityArmorStand::class.java) {
Minecraft.getMinecraft().theWorld.loadedEntityList
}
+ thenLiteralExecute("block") {
+ val pos = Minecraft.getMinecraft().thePlayer.rayTrace(4.0, 10f).blockPos
+
+ val block: IBlockState = Minecraft.getMinecraft().theWorld.getBlockState(pos)
+ if (block.block.hasTileEntity(block)) {
+ val te = Minecraft.getMinecraft().theWorld.getTileEntity(pos)
+ val s = StringBuilder().also {
+ it.appendLine("NBT: ${te.tileData}")
+ if (te is TileEntitySkull && te.playerProfile != null) {
+ it.appendLine("PlayerProfile:\nId: ")
+ it.appendLine(te.playerProfile.id)
+ it.append("Name: ")
+ it.appendLine(te.playerProfile.name)
+ it.append("Textures: ")
+ it.appendLine(te.playerProfile.properties.get("textures")?.firstOrNull()?.value)
+ }
+ }.toString().trim()
+
+ MiscUtils.copyToClipboard(s)
+ reply("Copied data to clipboard")
+ return@thenLiteralExecute
+ }
+ reply("No tile entity found at your cursor")
+ }.withHelp("Find the tile entity you're looking at and copy data about it to your clipboard")
+
thenExecute {
NotEnoughUpdates.INSTANCE.packDevEnabled = !NotEnoughUpdates.INSTANCE.packDevEnabled
if (NotEnoughUpdates.INSTANCE.packDevEnabled) {