diff --git a/src/main/kotlin/live/ixnoah/tapactions/TapActions.kt b/src/main/kotlin/live/ixnoah/tapactions/TapActions.kt index 4a0f5e3..b59968f 100644 --- a/src/main/kotlin/live/ixnoah/tapactions/TapActions.kt +++ b/src/main/kotlin/live/ixnoah/tapactions/TapActions.kt @@ -2,6 +2,7 @@ package live.ixnoah.tapactions import live.ixnoah.tapactions.actions.GeneralActions import live.ixnoah.tapactions.actions.HudActions +import live.ixnoah.tapactions.actions.WorldActions import live.ixnoah.tapactions.commands.CreateActionCommand import live.ixnoah.tapactions.events.ClientTick import live.ixnoah.tapactions.events.WorldLoad @@ -35,6 +36,7 @@ class TapActions { // Deploy actions GeneralActions.deploy() + WorldActions.deploy() HudActions.deploy() } } diff --git a/src/main/kotlin/live/ixnoah/tapactions/actions/GeneralActions.kt b/src/main/kotlin/live/ixnoah/tapactions/actions/GeneralActions.kt index 7eec181..16df7d5 100644 --- a/src/main/kotlin/live/ixnoah/tapactions/actions/GeneralActions.kt +++ b/src/main/kotlin/live/ixnoah/tapactions/actions/GeneralActions.kt @@ -3,6 +3,12 @@ package live.ixnoah.tapactions.actions import CommandQueue import live.ixnoah.tapactions.ActionManager import live.ixnoah.tapactions.wrappers.Scoreboard +import net.minecraft.client.Minecraft +import net.minecraft.event.ClickEvent +import net.minecraft.event.HoverEvent +import net.minecraft.util.ChatComponentStyle +import net.minecraft.util.ChatComponentText +import net.minecraft.util.ChatStyle object GeneralActions { private val nameRegex = Regex("^[0-9A-z '\"!@#\$%^*?]{0,20}\$") @@ -32,8 +38,20 @@ object GeneralActions { } } + private val actionVisitHouse = { params: MutableMap -> + Minecraft.getMinecraft().thePlayer.addChatMessage( + ChatComponentText("§eThis house wants you to visit §b${params["house"]}§e! Click to visit!") + // This is fucking awful but Minecraft devs has forced my hand + .setChatStyle(ChatStyle().setChatHoverEvent( + HoverEvent(HoverEvent.Action.SHOW_TEXT, ChatComponentText("§7/visit ${params["player"]} ${params["house"]}")) + ).setChatClickEvent(ClickEvent(ClickEvent.Action.RUN_COMMAND, "/visit ${params["player"]} ${params["house"]}")) + ) + ) + } + fun deploy() { ActionManager.registerAction("tap:identity", actionIdentity) - ActionManager.registerAction("tap:visibility", actionVisibility) + ActionManager.registerAction("tap:visibility", actionVisibility, mutableListOf("max")) + ActionManager.registerAction("tap:visit", actionVisitHouse, mutableListOf("player", "house")) } } \ No newline at end of file diff --git a/src/main/kotlin/live/ixnoah/tapactions/actions/WorldActions.kt b/src/main/kotlin/live/ixnoah/tapactions/actions/WorldActions.kt new file mode 100644 index 0000000..bfe484a --- /dev/null +++ b/src/main/kotlin/live/ixnoah/tapactions/actions/WorldActions.kt @@ -0,0 +1,33 @@ +package live.ixnoah.tapactions.actions + +import live.ixnoah.tapactions.ActionManager +import net.minecraft.client.Minecraft +import net.minecraft.util.EnumParticleTypes + +object WorldActions { + private val actionParticle = { params: MutableMap -> + val particleType = params["particle"]?.let { EnumParticleTypes.valueOf(it) } + + if (particleType !== null) { + Minecraft.getMinecraft().theWorld.spawnParticle( + particleType, + params["x"]?.toDoubleOrNull() ?: 0.00, + params["y"]?.toDoubleOrNull() ?: 0.00, + params["z"]?.toDoubleOrNull() ?: 0.00, + params["ox"]?.toDoubleOrNull() ?: 0.00, + params["oy"]?.toDoubleOrNull() ?: 0.00, + params["oz"]?.toDoubleOrNull() ?: 0.00, + ) + } + } + + fun deploy() { + ActionManager.registerAction( + "tap:particle", + actionParticle, + mutableListOf( + "particle", + "x", "y", "z", + )) + } +} \ No newline at end of file