Skip to content

Commit

Permalink
1.20.1
Browse files Browse the repository at this point in the history
Initial forge release
Parity with Fabric 1.0
  • Loading branch information
xanthian committed Oct 4, 2023
1 parent 7e6223f commit 2a8b1db
Show file tree
Hide file tree
Showing 59 changed files with 467 additions and 544 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
57 changes: 18 additions & 39 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### Eclipse ###
.apt_generated
# eclipse
bin
*.launch
.settings
.metadata
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
# idea
out
*.ipr
*.iws
*.iml
.idea

### VS Code ###
.vscode/
# gradle
build
.gradle

### Mac OS ###
.DS_Store
/src/main/generated/.cache/
/.idea/
# other
eclipse
run
run-data
183 changes: 117 additions & 66 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,104 +1,155 @@
buildscript {
repositories {
maven { url = 'https://maven.minecraftforge.net' }
maven { url = 'https://repo.spongepowered.org/repository/maven-public/' }
maven { url = 'https://maven.parchmentmc.org' }
}
dependencies {
classpath "net.minecraftforge.gradle:ForgeGradle:${forgegradle_version}"
}
}

plugins {
id 'fabric-loom' version '1.2-SNAPSHOT'
id 'idea'
id 'maven-publish'
id 'net.minecraftforge.gradle' version '[6.0,6.2)'
id 'org.parchmentmc.librarian.forgegradle' version '1.+'
}

version = project.mod_version
group = project.maven_group
version = mod_version
group = mod_group_id

base {
archivesName = project.archives_base_name
archivesName = mod_id
}

repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
java.toolchain.languageVersion = JavaLanguageVersion.of(17)

loom {
println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}"
minecraft {
mappings channel: mapping_channel, version: mapping_version
copyIdeResources = true
runs {
// This adds a new gradle task that runs the datagen API: "gradlew runDatagen"
datagen {
inherit server
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/main/generated")}"
vmArg "-Dfabric-api.datagen.modid=variantchiseledbookshelves"

runDir "build/datagen"
client {
workingDirectory project.file('run')

property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

property 'forge.enabledGameTestNamespaces', mod_id

mods {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}

// Add the generated resources to the main source set
sourceSets {
main {
resources {
srcDirs += [
'src/main/generated'
]
server {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

property 'forge.enabledGameTestNamespaces', mod_id

mods {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}
dependencies {
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"

// Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
gameTestServer {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'

// Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.
property 'forge.logging.console.level', 'debug'

// modImplementation "net.fabricmc.fabric-api:fabric-api-deprecated:${project.fabric_version}"
}
property 'forge.enabledGameTestNamespaces', mod_id

processResources {
inputs.property "version", project.version
mods {
"${mod_id}" {
source sourceSets.main
}
}
}

filesMatching("fabric.mod.json") {
expand "version": project.version
data {
workingDirectory project.file('run')
property 'forge.logging.markers', 'REGISTRIES'

property 'forge.logging.console.level', 'debug'

args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
"${mod_id}" {
source sourceSets.main
}
}
}
}
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
repositories {

}
def resourceTargets = ['META-INF/mods.toml', 'pack.mcmeta']
def replaceProperties = [
minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range,
forge_version: forge_version, forge_version_range: forge_version_range,
loader_version_range: loader_version_range,
mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version,
mod_authors: mod_authors, mod_description: mod_description
]

dependencies {

java {
// Loom will automatically attach sourcesJar to a RemapSourcesJar task and to the "build" task
// if it is present.
// If you remove this line, sources will not be generated.
withSourcesJar()
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}


processResources {
inputs.properties replaceProperties
replaceProperties.put 'project', project

filesMatching(resourceTargets) {
expand replaceProperties
}
}

jar {
from("LICENSE") {
rename { "${it}_${project.archivesBaseName}"}
manifest {
attributes([
"Specification-Title" : mod_id,
"Specification-Vendor" : mod_authors,
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : mod_authors,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

// configure the maven publication
jar.finalizedBy('reobfJar')

publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact jar
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
// Notice: This block does NOT have the same function as the block in the top level.
// The repositories here will be used for publishing your artifact, not for
// retrieving dependencies.
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
}
}

tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
34 changes: 19 additions & 15 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.parallel=true
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

# Fabric Properties
minecraft_version=1.20
yarn_mappings=1.20+build.1
loader_version=0.14.21
minecraft_version=1.20.1
minecraft_version_range=[1.20,1.21)
forge_version=47.2.1
forge_version_range=[47,)
loader_version_range=[47,)
mapping_channel=parchment
mapping_version=2023.09.03-1.20.1
mixin_version = 0.8.5
forgegradle_version = 6.0.6
mixingradle_version = 0.7-SNAPSHOT

#Fabric api
fabric_version=0.83.0+1.20

# Mod Properties
mod_id=variantchiseledbookshelves
mod_name=Variant Chiseled Bookshelves
mod_license=MIT
mod_version=1.0
maven_group=net.xanthian
archives_base_name=variantchiseledbookshelves


mod_group_id=net.xanthian.variantchiseledbookshelves
mod_authors=Xanthian
mod_description=Chiseled Bookshelves for all wood types.
pack_format_number=15
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
12 changes: 8 additions & 4 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
pluginManagement {
repositories {
gradlePluginPortal()
maven {
name = 'Fabric'
url = 'https://maven.fabricmc.net/'
name = 'MinecraftForge'
url = 'https://maven.minecraftforge.net/'
}
mavenCentral()
gradlePluginPortal()
maven { url = 'https://maven.parchmentmc.org' }
}
}

plugins {
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0'
}

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2a8b1db

Please sign in to comment.