Skip to content

Commit

Permalink
Remove Fishing Spot hotkey
Browse files Browse the repository at this point in the history
This was mostly removed due to the mod being more focused on reporting bugs on MCC Island more easily. The Fishing Spot sharing hotkey was mostly a gameplay feature to help others in early testing. Since Fishing is no longer in a testing state, this feature will be removed and should be in another mod that focuses more on gameplay instead of reporting bugs, e.g. Island Utils (if they want to implement that feature).
  • Loading branch information
derNiklaas committed Dec 23, 2024
1 parent 245876e commit 7d51481
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 71 deletions.
58 changes: 0 additions & 58 deletions src/main/kotlin/de/derniklaas/buildbugs/BugCreator.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import de.derniklaas.buildbugs.utils.ServerState
import de.derniklaas.buildbugs.utils.Utils
import net.minecraft.client.MinecraftClient
import net.minecraft.client.util.Clipboard
import net.minecraft.entity.decoration.DisplayEntity
import net.minecraft.util.math.BlockPos
import net.minecraft.util.math.Box

object BugCreator {

Expand Down Expand Up @@ -55,62 +53,6 @@ object BugCreator {
}
}

fun shareFishingSpot() {
val client = MinecraftClient.getInstance()
val server = client.currentServerEntry ?: return
val player = client.player ?: return

// Check if the player is connected to a server
if (server.isLocal) {
Utils.sendErrorMessage("You are not connected to a server.")
return
}

// Check if the player is connected to a MCC related server
if (!Utils.isOnMCCServer()) {
Utils.sendErrorMessage("You are not connected to a MCC related server.")
return
}

// Get the "area" of the player
val area = gameState.getFancyName()
val map = gameState.mapName

val fishHook = player.fishHook
if (fishHook == null) {
Utils.sendErrorMessage("You are not fishing.")
return
}
val blockPos = fishHook.blockPos

val box = Box.of(blockPos.toCenterPos(), 6.0, 6.0, 6.0)
val entities = player.world.getOtherEntities(null, box) { entity ->
entity is DisplayEntity.TextDisplayEntity
}

if (entities.isNotEmpty()) {
val textDisplay = entities.first() as DisplayEntity.TextDisplayEntity
val text = textDisplay.data!!.text.asTruncatedString(Int.MAX_VALUE)

val perks = text.split("\n").filter { it.contains("+") }.map { "+" + it.split("+")[1] }.joinToString(", ")
if (perks.isNotEmpty()) {
val minecraftMessage = getCopyMessage(area, map, blockPos).trim() + " $perks"
Utils.sendMiniMessage(
"<click:copy_to_clipboard:'${
minecraftMessage.replace(
"'", "\\\'"
)
}'>$minecraftMessage <yellow><bold>[CLICK TO COPY]</bold></yellow></click>", true
)
if (BuildBugsClientEntrypoint.config.copyToClipboard) {
setClipboard(minecraftMessage)
}
return
}
}
Utils.sendErrorMessage("Could not find a fishing spot.")
}

/**
* Updates [gameState] when a new packet is received.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,10 @@ class BuildBugsClientEntrypoint : ClientModInitializer {
)
)

val shareFishingSpotKeybinding = KeyBindingHelper.registerKeyBinding(
KeyBinding(
"key.buildbugs.share_fishing_spot",
InputUtil.Type.KEYSYM,
GLFW.GLFW_KEY_J,
"category.buildbugs"
)
)

ClientTickEvents.END_CLIENT_TICK.register {
if (reportKeybinding.wasPressed()) {
BugCreator.report()
}
if (shareFishingSpotKeybinding.wasPressed()) {
BugCreator.shareFishingSpot()
}
if (bugreportKeybinding.wasPressed()) {
if (!Utils.isOnMCCServer()) {
Utils.sendErrorMessage("You are not connected to a MCC related server.")
Expand Down
1 change: 0 additions & 1 deletion src/main/resources/assets/buildbugs/lang/en_us.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"key.buildbugs.report": "Generate a build bug report",
"key.buildbugs.bugreport": "Generate a /bugreport",
"key.buildbugs.share_fishing_spot": "Share fishing spot",
"category.buildbugs": "#build-bugs"
}

0 comments on commit 7d51481

Please sign in to comment.