Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
118 changes: 118 additions & 0 deletions Minecraft/ForgeMod/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
# User-specific stuff
.idea/

*.iml
*.ipr
*.iws

# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

# General
.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp

# Windows shortcuts
*.lnk

.gradle
build/

# Ignore Gradle GUI config
gradle-app.setting

# Cache of project
.gradletasknamecache

**/build/

# Common working directory
run/

# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
!gradle-wrapper.jar
2 changes: 2 additions & 0 deletions Minecraft/ForgeMod/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Copyright (c) 2023 PieTheNiceGuy
All rights reserved.
191 changes: 191 additions & 0 deletions Minecraft/ForgeMod/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
plugins {
id 'net.minecraftforge.gradle' version "${forgegradle_version}"
}


group = "${project_group}"
version = "${project_version}"

// This is for controlling what java version should be used to compile your mod
java {
archivesBaseName = "${project_name}"
toolchain.languageVersion = JavaLanguageVersion.of(project.java_version)
}
// This Minecraft target is used for the ForgeGradle tasks.
// This is where the runClient/runServer tasks are defined, as well as the
// mappings and access transformers.
minecraft {
mappings channel: "${minecraft_mappings_channel}", version: "${minecraft_mappings_version}"

// accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

// Default run configurations.
// These can be tweaked, removed, or duplicated as needed.
runs {
client {
workingDirectory project.file('run')

// Recommended logging data for a userdev environment
// The markers can be added/remove as needed separated by commas.
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property 'forge.logging.markers', 'REGISTRIES'


// Recommended logging level for the console
// You can set various levels here.
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
property 'forge.logging.console.level', 'debug'

// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
property 'forge.enabledGameTestNamespaces', "${project_name}"

mods {
"${minecraft_mod_id}" {
// Because the gradle.properties file is handling the task name,
// IntelliJ wll not be able to infer what the main source set is.
source sourceSets.main
}
}
}

server {
workingDirectory project.file('run')

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

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

property 'forge.enabledGameTestNamespaces', "${project_name}"

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

// This run config launches GameTestServer and runs all registered gametests, then exits.
// By default, the server will crash when no gametests are provided.
// The gametest system is also enabled by default for other run configs under the /test command.
gameTestServer {
workingDirectory project.file('run')

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

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

property 'forge.enabledGameTestNamespaces', "${project_name}"

mods {
"${minecraft_mod_id}" {
// Because the gradle.properties file is handling the task name,
// IntelliJ wll not be able to infer what the main source set is.
source sourceSets.main
}
}
}

// This run config allows you to generate a data your mod uses from java.
// Normally to add recipes, loot tables, advancements, etc. you would need to create json files.
// This run config allows you to create these files from java code.
// This is useful for mods that have a lot of data, or for mods that want to generate data based on other data.
// The generated data is placed in the src/main/resources/generated folder.
// You can see this in the args passed to the run config below.
data {
workingDirectory project.file('run')

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

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

// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
args '--mod', "${minecraft_mod_id}", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')

mods {
"${minecraft_mod_id}" {
// Because the gradle.properties file is handling the task name,
// IntelliJ wll not be able to infer what the main source set is.
source sourceSets.main
}
}
}
}
}

// Include resources generated by data generators.
sourceSets.main.resources { srcDir 'src/generated/resources' }

repositories {
// Put repositories for dependencies here
// ForgeGradle automatically adds the Forge maven and Maven Central for you

// If you have mod jar dependencies in ./libs, you can declare them as a repository like so:
// flatDir {
// dir 'libs'
// }
}

dependencies {
// Specify the version of Minecraft to use. If this is any group other than 'net.minecraft' it is assumed
// that the dep is a ForgeGradle 'patcher' dependency, and its patches will be applied.
// The userdev artifact is a special name and will get all sorts of transformations applied to it.
minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}"

// Real mod deobf dependency examples - these get remapped to your current mappings
// compileOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}:api") // Adds JEI API as a compile dependency
// runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}:${jei_version}") // Adds the full JEI mod as a runtime dependency
// implementation fg.deobf("com.tterrag.registrate:Registrate:MC${mc_version}-${registrate_version}") // Adds registrate as a dependency

// Examples using mod jars from ./libs
// implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}")

// For more info...
// http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html
// http://www.gradle.org/docs/current/userguide/dependency_management.html
}

// Example for how to get properties into the manifest for reading at runtime.
jar {
manifest {
attributes([
"Specification-Title" : "${minecraft_mod_id}",
"Specification-Vendor" : "${minecraft_mod_author}",
"Specification-Version" : "1", // We are version 1 of ourselves
"Implementation-Title" : project.name,
"Implementation-Version" : project.jar.archiveVersion,
"Implementation-Vendor" : "${minecraft_mod_author}",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

jar.finalizedBy('reobfJar')

// This ensures that while compiling java, we make sure to use the utf-8 encoding.
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation
}
// This ensures that when we build our project, before we compile it, we replace
// various placeholder variables with the actual values we want.
// For example, we replace ${version} with the version of our mod.
// This is useful for things like the @Mod annotation, which requires a version.
tasks.withType(ProcessResources).configureEach {
processResources {
// This inputs.property line makes it so that if the value of the version property changes,
// the task will be re-run to ensure that the new value is used.
inputs.property 'version', project.version
inputs.property 'mcversion', minecraft_version
inputs.property 'modid', minecraft_mod_id
inputs.property 'moddescr', minecraft_mod_description
inputs.property 'modname', minecraft_mod_name
inputs.property 'modauthor', minecraft_mod_author

// This filesMatching line makes it so that all the files matching those patterns,
// are processed by this task.
filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) {
expand project.properties
}
}
}
52 changes: 52 additions & 0 deletions Minecraft/ForgeMod/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

# This is the name of the project, this is also
# how your IDE will name the project
project_name = PieMod
# This is the version of your mod
# You can use the following versioning scheme if you want
# major.minor.patch
# major - Major changes to the mod, such as a complete rewrite
# minor - Minor changes to the mod, such as new features
# patch - Patch changes to the mod, such as bug fixes
project_version = 1.0.0
# This is the group of your mod, this is used for the package name
# of your mod
project_group = ser321.examples

# This is the internal mod ID, this is used for resource locations and other things.
minecraft_mod_id = piemod
# This is the mod name, this is what is displayed in the mod list, and will be shown
# in the mod menu of forge.
minecraft_mod_name = Pie Mod
# This is the mod description, this is what is displayed in the mod list, and will be shown
# in the mod menu of forge as well.
minecraft_mod_description = A mod that adds Pies to Minecraft!!!
# This is the mod author list, this is what is displayed in the mod list, and will be shown
# in the mod menu of forge as well.
minecraft_mod_author = PieTheNiceGuy




# Versions of the libraries we depend on and use.
# If you change the minecraft version, you may need to change the mappings version.
minecraft_version = 1.19.3
# This is the version of the minecraft forge library we use.
forge_version = 44.1.7
# This is the version of the forge gradle plugin we use.
forgegradle_version = 5.1.+
# This is the java version that is used to compile the mod and used for compatibility
java_version = 17

# Minecraft's code is obfuscated, so we need to de-obfuscate it so that we can add meaningful functionality.
# Thankfully minecraft released "mapping" files that tell our IDE how to de-obfuscate the code.
# The channel we will use is "official" which is the official mappings for the version of Minecraft we are using.
# The version of the mappings will be the same as the version of Minecraft we are using when using the "official" channel.
# For snapshots, we can use the "snapshot" channel, but we will need to specify the version of the mappings.
# For more information, see https://minecraft.fandom.com/wiki/Obfuscation_map
minecraft_mappings_channel = official
minecraft_mappings_version = 1.19.3


Binary file not shown.
5 changes: 5 additions & 0 deletions Minecraft/ForgeMod/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading