更新JavaDoc

This commit is contained in:
叁玖领域 2025-11-01 23:48:06 +08:00
parent 54bfdaf0b4
commit 4f38923636
3 changed files with 46 additions and 12 deletions

View File

@ -149,14 +149,23 @@ javadoc {
addBooleanOption('html5', true)
}
source = sourceSets.main.allJava
//
if (sourceSets.main.allJava.files.any { it.exists() }) {
source = sourceSets.main.allJava
}
classpath = configurations.compileClasspath
exclude '**/test/**'
exclude '**/internal/**'
//
doFirst {
destinationDir.mkdirs()
}
}
tasks.register('javadocJar', Jar) {
archiveClassifier.set('javadoc')
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-javadoc.jar"
archiveClassifier.set("javadoc")
from tasks.javadoc
dependsOn tasks.javadoc
}
@ -182,6 +191,25 @@ tasks.register('deobfJar', Jar) {
dependsOn classes
}
tasks.register('sourceJar', Jar) {
from(sourceSets.main.allSource) // java
archiveFileName = "${mod_id}-${minecraft_version}-${mod_version}-sources.jar"
archiveClassifier.set("sources")
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
manifest {
attributes([
'Specification-Title' : mod_id,
'Specification-Vendor' : mod_authors,
'Specification-Version' : '1',
'Implementation-Title' : project.name,
'Implementation-Version' : archiveVersion,
'Implementation-Vendor' : mod_authors,
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
}
dependsOn classes
}
@ -192,6 +220,7 @@ publishing {
mavenJava(MavenPublication) {
artifactId = mod_id
artifact deobfJar
artifact sourceJar
artifact javadocJar
pom {
@ -322,6 +351,10 @@ tasks.register('publishToNexus') {
description = 'Publishes all publications to LTD Nexus'
dependsOn 'publishMavenJavaPublicationToLTDNexusRepository'
}
tasks.named('build') {
dependsOn javadocJar, sourceJar
}
tasks.register('publishLocal') {
group = 'publishing'
@ -349,12 +382,3 @@ idea {
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
afterEvaluate {
tasks.named('deobfJar') {
doLast {
def jar = file(layout.buildDirectory.dir("repo") + "${mod_id}-${minecraft_version}-${mod_version}.jar")
if (jar.exists()) ant.delete(jar)
}
}
}

View File

@ -33,7 +33,7 @@ mod_name=3944Realms 's Lib Mod
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
mod_license=MIT
# The mod version. See https://semver.org/
mod_version=0.0.16
mod_version=0.0.17
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
# This should match the base package used for the mod sources.
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html

View File

@ -53,6 +53,16 @@ public class BlockRegistryBuilder {
return this;
}
/**
* 注册对应的方块物品
*
* @param blockObject the block object
* @param blockDeferredRegister the block deferred register
*/
public void registerBlockItem(RegistryObject<Block> blockObject, @NotNull DeferredRegister<Block> blockDeferredRegister) {
blockDeferredRegister.register(this.registryName, blockObject);
}
/**
* 内部方法注册对应的方块物品
*/