Skip to content

Kotori316/SLP

Repository files navigation

Scala language provider for Minecraft 26.1.x.

Branch 26.1

This mod adds a Scala library to Minecraft 26.1.2 with Forge and NeoForge. NO COMPATIBILITY WITH 1.x version of SLP.

Usage

  • For Player – Download a Jar file from Curse Forge or Modrinth and move the file to your mods folder. This mod will not appear in the mod list.

  • For Developer
    See the example directory.

    In your build.gradle, add below code in the top-level.

    repositories {
        maven {
            name = "kotori316"
            url = uri("https://maven.kotori316.com")
            content {
                includeModule("com.kotori316", "ScalableCatsForce".toLowerCase())
                includeModule("org.typelevel", "cats-core_3")
                includeModule("org.typelevel", "cats-kernel_3")
                includeModule("org.typelevel", "cats-free_3")
            }
        }
    }
    
    dependencies {
        // Add Forge or NeoForge dependency as the platform requires
    
        // Scala, no need to add Scala2 dependency since 3.8.3
        implementation('org.scala-lang:scala3-library_3:3.8.3')
        // Add if you need this library. I use a modified version of Cats to avoid some module errors.
        implementation('org.typelevel:cats-kernel_3:2.13.0-kotori')
    
        // The language loader. You can put the jar to the mods dir instead of declaring in `build.gradle.kts`.
        runtimeOnly("com.kotori316:scalablecatsforce:4.0.4-mc26.1.2-3.8.3:dev") {
            transitive(false)
        }
    }
    • If the Minecraft client doesn't launch with an exception to modules, change scala dependency from "implementation" to "compileOnly" and add slp mod in the mods directory.
    • Change the library version if needed.
      • See detail pages in CurseForge or Modrinth to get which library version is included in the Jar file.
    • From 26.1.2 version, SLP includes Scala 3.8.3

Limitations

In this section, I note some points you should care.

  1. Avoid use of Mod.EventBusSubscriber in Java code. This will cause exception in "compileScala" task.
  • Use in Scala code will not throw an exception.
  1. If you got the compile error "ambiguous reference to overloaded definition", specify the return type.
  • For example, val offsetPos = pos.relative(direction) will cause this error because relative is declared both in BlockPos and Vec3i, and the return types are different. So, the compiler can't determine which method to call. To resolve this issue, specify the return type as follows. val offsetPos: BlockPos = pos.relative(direction)

API

About

Scala language provider for Minecraft 1.13.2 and newer

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors