This is a script that scrapes from our internal riding assignment spreadsheet.
This embeds itself into Cobblemon and forces it to render Pokemon to compute seat locations. Setting this up and running it is a bit complicated. If you need assistance feel free to reach out to Landon (Discord: landonjw123).
How to run:
-
Install the Cursive IntelliJ extension
-
Add Clojure runtime dependencies to the Fabric
build.gradle.kts.- Add this to plugins:
id("dev.clojurephant.clojure") version "0.8.0" - Add this to repositories:
maven(url = "https://repo.clojars.org/") - Add this to dependencies
modImplementation("org.clojure:clojure:1.11.2") modImplementation("org.clojure:tools.namespace:1.3.0") modImplementation("nrepl:nrepl:0.8.3") modImplementation("clj-http:clj-http:3.12.3") modImplementation("org.clojure:data.json:2.5.1") modImplementation("org.clojure:data.csv:1.1.0")
- Add this to plugins:
-
Set up a NREPL Server in
CobblemonFabric- Copy and paste this function
private fun initialiseREPL() { val require = Clojure.`var`("clojure.core", "require") require.invoke(Clojure.read("nrepl.server")) val startServer = Clojure.`var`("nrepl.server", "start-server") startServer.invoke(Clojure.read(":port"), 9080) println("Started nREPL server on port 9080") } - Call this at the end of the
initializefunction
- Copy and paste this function
-
Modify
PokemonRendererso we can hook into the render thread- Add
var runnable: Runnable? = nullto thePokemonRenderercompanion object - At the beginning of the
renderfunction, add this code blocktry { runnable?.run() } catch (e: Exception) { e.printStackTrace() }
- Add
-
Force locators to update in
PokemonGuiUtils- In
PokemonGuiUtils#drawProfilePokemon, add this line afterapplyAnimations(currently L129)
model.updateLocators(null, state) - In
-
Run the Fabric client
-
Add a new configuration (beside 'Play' button, Edit Configurations)
- Click the plus, select Remote Clojure REPL
- Set connection type to nREPL, port to 9080
- Run this new configuration
- A new window on the right-hand side should open, where you can evaluate code.
-
Go into a superflat singleplayer world, go to [0, -60, 0] (make sure Pokémon are in your field of view)
-
Copy script and paste it into the REPL console
-
Wait a couple seconds, then reload your species directory.