Skip to content

Commit

Permalink
Commit the entire mod because I forgot we had version control
Browse files Browse the repository at this point in the history
  • Loading branch information
gingershaped committed Jan 26, 2025
0 parents commit 0f837fb
Show file tree
Hide file tree
Showing 29 changed files with 1,161 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Disable autocrlf on generated files, they always generate with LF
# Add any extra files or paths here to make git stop saying they
# are changed when only line endings change.
src/generated/**/.cache/cache text eol=lf
src/generated/**/*.json text eol=lf
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.project

# idea
out
*.ipr
*.iws
*.iml
.idea

# gradle
build
.gradle

# other
eclipse
run
runs
run-data

repo
66 changes: 66 additions & 0 deletions .kotlin/errors/errors-1737844529899.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
kotlin version: 2.0.0
error message: Incremental compilation failed: java.lang.IndexOutOfBoundsException
java.lang.RuntimeException: java.lang.IndexOutOfBoundsException
at org.jetbrains.kotlin.com.intellij.util.io.PersistentEnumeratorBase.catchCorruption(PersistentEnumeratorBase.java:628)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentEnumeratorBase.doEnumerate(PersistentEnumeratorBase.java:266)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentEnumeratorBase.tryEnumerate(PersistentEnumeratorBase.java:257)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentMapImpl.doGet(PersistentMapImpl.java:583)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentMapImpl.get(PersistentMapImpl.java:545)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentHashMap.get(PersistentHashMap.java:178)
at org.jetbrains.kotlin.incremental.storage.LazyStorage.get(LazyStorage.kt:74)
at org.jetbrains.kotlin.incremental.storage.InMemoryStorage.get(InMemoryStorage.kt:68)
at org.jetbrains.kotlin.incremental.storage.PersistentStorageWrapper.get(PersistentStorage.kt:90)
at org.jetbrains.kotlin.incremental.AbstractIncrementalCache.getSourceFileIfClass(AbstractIncrementalCache.kt:109)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.additionalDirtyFiles(IncrementalJvmCompilerRunner.kt:391)
at org.jetbrains.kotlin.incremental.IncrementalJvmCompilerRunner.additionalDirtyFiles(IncrementalJvmCompilerRunner.kt:62)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.doCompile(IncrementalCompilerRunner.kt:526)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compileImpl(IncrementalCompilerRunner.kt:423)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.tryCompileIncrementally$lambda$9$compile(IncrementalCompilerRunner.kt:249)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.tryCompileIncrementally(IncrementalCompilerRunner.kt:267)
at org.jetbrains.kotlin.incremental.IncrementalCompilerRunner.compile(IncrementalCompilerRunner.kt:120)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.execIncrementalCompiler(CompileServiceImpl.kt:676)
at org.jetbrains.kotlin.daemon.CompileServiceImplBase.access$execIncrementalCompiler(CompileServiceImpl.kt:92)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1661)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:360)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200)
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:714)
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:598)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:844)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:721)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:720)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.IndexOutOfBoundsException
at java.base/java.nio.Buffer$1.apply(Buffer.java:757)
at java.base/java.nio.Buffer$1.apply(Buffer.java:754)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:213)
at java.base/jdk.internal.util.Preconditions$4.apply(Preconditions.java:210)
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:98)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:106)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:302)
at java.base/java.nio.Buffer.checkIndex(Buffer.java:768)
at java.base/java.nio.DirectByteBuffer.get(DirectByteBuffer.java:342)
at org.jetbrains.kotlin.com.intellij.util.io.DirectBufferWrapper.get(DirectBufferWrapper.java:62)
at org.jetbrains.kotlin.com.intellij.util.io.keyStorage.AppendableStorageBackedByResizableMappedFile$3.write(AppendableStorageBackedByResizableMappedFile.java:207)
at java.base/java.io.OutputStream.write(OutputStream.java:167)
at java.base/java.io.DataOutputStream.writeInt(DataOutputStream.java:206)
at org.jetbrains.kotlin.com.intellij.util.io.IOUtil.writeString(IOUtil.java:58)
at org.jetbrains.kotlin.incremental.storage.StringExternalizer.save(externalizers.kt:224)
at org.jetbrains.kotlin.incremental.storage.ExternalizersKt.writeString(externalizers.kt:254)
at org.jetbrains.kotlin.incremental.storage.FqNameExternalizer.save(externalizers.kt:84)
at org.jetbrains.kotlin.incremental.storage.FqNameExternalizer.save(externalizers.kt:81)
at org.jetbrains.kotlin.incremental.storage.ExternalizersKt$toDescriptor$1.save(externalizers.kt)
at org.jetbrains.kotlin.com.intellij.util.io.keyStorage.AppendableStorageBackedByResizableMappedFile.checkBytesAreTheSame(AppendableStorageBackedByResizableMappedFile.java:165)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentEnumeratorBase.isKeyAtIndex(PersistentEnumeratorBase.java:370)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentBTreeEnumerator.enumerateImpl(PersistentBTreeEnumerator.java:528)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentEnumeratorBase.lambda$doEnumerate$0(PersistentEnumeratorBase.java:267)
at org.jetbrains.kotlin.com.intellij.util.io.PersistentEnumeratorBase.catchCorruption(PersistentEnumeratorBase.java:608)
... 34 more


25 changes: 25 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Installation information
=======

This template repository can be directly cloned to get you started with a new
mod. Simply create a new repository cloned from this one, by following the
instructions provided by [GitHub](https://docs.github.com/en/repositories/creating-and-managing-repositories/creating-a-repository-from-a-template).

Once you have your clone, simply open the repository in the IDE of your choice. The usual recommendation for an IDE is either IntelliJ IDEA or Eclipse.

If at any point you are missing libraries in your IDE, or you've run into problems you can
run `gradlew --refresh-dependencies` to refresh the local cache. `gradlew clean` to reset everything
{this does not affect your code} and then start the process again.

Mapping Names:
============
By default, the MDK is configured to use the official mapping names from Mojang for methods and fields
in the Minecraft codebase. These names are covered by a specific license. All modders should be aware of this
license. For the latest license text, refer to the mapping file itself, or the reference copy here:
https://github.com/NeoForged/NeoForm/blob/main/Mojang.md

Additional Resources:
==========
Community Documentation: https://docs.neoforged.net/
NeoForged Discord: https://discord.neoforged.net/
143 changes: 143 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
import org.jetbrains.kotlin.gradle.utils.extendsFrom

plugins {
id("java-library")
id("maven-publish")
id("net.neoforged.moddev") version "2.0.+"
id("idea")

kotlin("jvm") version "2.0.0"
}

tasks.named<Wrapper>("wrapper").configure {
// Define wrapper values here so as to not have to always do so when updating gradlew.properties.
// Switching this to Wrapper.DistributionType.ALL will download the full gradle sources that comes with
// documentation attached on cursor hover of gradle classes and methods. However, this comes with increased
// file size for Gradle. If you do switch this to ALL, run the Gradle wrapper task twice afterwards.
// (Verify by checking gradle/wrapper/gradle-wrapper.properties to see if distributionUrl now points to `-all`)
distributionType = Wrapper.DistributionType.BIN
}

val modId = property("mod_id") as String

version = property("mod_version") as String
group = property("mod_group_id") as String

repositories {
mavenLocal()
maven {
name = "Kotlin for Forge"
setUrl("https://thedarkcolour.github.io/KotlinForForge/")
}
}

base {
archivesName.set(modId)
}

// Mojang ships Java 21 to end users starting in 1.20.5, so mods should target Java 21.
java.toolchain.languageVersion.set(JavaLanguageVersion.of(21))

neoForge {
// Specify the version of NeoForge to use.
version = property("neo_version") as String

parchment {
mappingsVersion = property("parchment_mappings_version") as String
minecraftVersion = property("parchment_minecraft_version") as String
}

// This line is optional. Access Transformers are automatically detected
// accessTransformers = project.files("src/main/resources/META-INF/accesstransformer.cfg")

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
create("client") {
client()

systemProperty("neoforge.enabledGameTestNamespaces", modId)
}

create("server") {
server()
programArgument("--nogui")
systemProperty("neoforge.enabledGameTestNamespaces", modId)
}

create("gameTestServer") {
type = "gameTestServer"
systemProperty("neoforge.enabledGameTestNamespaces", modId)
}

create("data") {
clientData()

programArguments.addAll(
"--mod", modId,
"--all",
"--output", file("src/generated/resources/").absolutePath,
"--existing", file("src/main/resources/").absolutePath,
)
}

configureEach {
systemProperty("forge.logging.markers", "REGISTRIES")
logLevel = org.slf4j.event.Level.DEBUG
}
}

mods {
// define mod <-> source bindings
// these are used to tell the game which sources are for which mod
// multi mod projects should define one per mod
create(modId) {
sourceSet(sourceSets.main.get())
}
}
}

// Include resources generated by data generators.
sourceSets.main.get().resources { srcDir("src/generated/resources") }

// Sets up a dependency configuration called "localRuntime".
// This configuration should be used instead of "runtimeOnly" to declare
// a dependency that will be present for runtime testing but that is
// "optional", meaning it will not be pulled by dependents of this mod.
configurations {
create("localRuntime")
runtimeClasspath.extendsFrom(named("localRuntime"))
}

dependencies {
implementation("thedarkcolour:kotlinforforge-neoforge:${property("loader_version")}")
}

val generateModMetadata = tasks.register<ProcessResources>("generateModMetadata") {
val replaceProperties = listOf(
"minecraft_version", "minecraft_version_range",
"neo_version", "neo_version_range",
"loader_version_range",
"mod_id", "mod_name", "mod_license", "mod_version",
"mod_authors", "mod_description",
).associateWith { (project.properties[it] as String) }

inputs.properties(replaceProperties)
expand(replaceProperties)
.from("src/main/templates")
.into("build/generated/sources/modMetadata")
}

sourceSets.main.get().resources.srcDir(generateModMetadata)
neoForge.ideSyncTask(generateModMetadata)

tasks.withType<JavaCompile>().configureEach {
options.encoding = "UTF-8"
}

idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
}
}
22 changes: 22 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
org.gradle.jvmargs=-Xmx1G
org.gradle.daemon=true
org.gradle.parallel=true
org.gradle.caching=true
org.gradle.configuration-cache=true

parchment_minecraft_version=1.21.4
parchment_mappings_version=2025.01.19
minecraft_version=1.21.4
minecraft_version_range=[1.21.4]
neo_version=21.4.72-beta
neo_version_range=[21.4.72-beta,)
loader_version=5.7.0
loader_version_range=[5.7,)

mod_id=afkmarker
mod_name=AFK Marker
mod_license=MPL-2.0
mod_version=21.4.1.0
mod_group_id=computer.gingershaped.afkmarker
mod_authors=Ginger
mod_description=A configurable indicator for AFK players.
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0f837fb

Please sign in to comment.