Groovy with eclipse-tutorial

本文介绍 Groovy 编程语言的基础知识及高级特性, 涵盖语法、集成环境及最佳实践等内容, 适合初学者及有经验的开发者快速上手。
build.gradle:plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0.36,6.2)' } version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 21 to end users in 1.20.5+, so your mod should target Java 21. java.toolchain.languageVersion = JavaLanguageVersion.of(21) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { // The mappings can be changed at any time and must be in the following format. // Channel: Version: // official MCVersion Official field/method names from Mojang mapping files // parchment YYYY.MM.DD-MCVersion Open community-sourced parameter names and javadocs layered on top of official // // Parchment is an unofficial project maintained by ParchmentMC, separate from MinecraftForge // Additional setup is needed to use their mappings: https://parchmentmc.org/docs/getting-started // // Simply re-run your setup task after changing the mappings to update your workspace. mappings channel: mapping_channel, version: mapping_version // Forge 1.20.6 and newer use official mappings at runtime, so we shouldn't reobf from official to SRG reobf = false // When true, this property will have all Eclipse/IntelliJ IDEA run configurations run the "prepareX" task for the given run configuration before launching the game. // In most cases, it is not necessary to enable. // enableEclipsePrepareRuns = true // enableIdeaPrepareRuns = true // This property allows configuring Gradle's ProcessResources task(s) to run on IDE output locations before launching the game. // It is REQUIRED to be set to true for this template to function. // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html copyIdeResources = true // When true, this property will add the folder name of all declared run configurations to generated IDE run configurations. // The folder name can be set on a run configuration using the "folderName" property. // By default, the folder name of a run configuration is the name of the Gradle project containing it. // generateRunFolders = true // This property enables access transformers for use in development, applied to the Minecraft artifact. // The access transformer file can be anywhere in the project. // However, it must be at "META-INF/accesstransformer.cfg" in the final mod jar to be loaded by Forge. // This default location is a best practice to automatically put the file in the right place in the final jar. // See https://docs.minecraftforge.net/en/latest/advanced/accesstransformers/ for more information. // accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') // Default run configurations. // These can be tweaked, removed, or duplicated as needed. runs { // applies to all the run configs below configureEach { workingDirectory project.file('run') // Optional additional logging. 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' property 'forge.logging.console.level', 'debug' // Recommended for development - enables more descriptive errors at the cost of slower startup and registration. property 'eventbus.api.strictRuntimeChecks', 'true' // arg "-mixin.config=${mod_id}.mixins.json" } client { // Comma-separated list of namespaces to load gametests from. Empty = all namespaces. property 'forge.enabledGameTestNamespaces', mod_id } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } // 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 { property 'forge.enabledGameTestNamespaces', mod_id } data { // example of overriding the workingDirectory set in configureEach above workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { // Put repositories for dependencies here mavenCentral() maven { name = 'Forge' url = 'https://maven.minecraftforge.net' } maven { name = 'Minecraft libraries' url = 'https://libraries.minecraft.net' } exclusiveContent { forRepository { maven { name = 'Sponge' url = 'https://repo.spongepowered.org/repository/maven-public' } } filter { includeGroupAndSubgroups('org.spongepowered') } } // If you have mod jar dependencies in ./libs, you can declare them as a repository like so. // See https://docs.gradle.org/current/userguide/declaring_repositories.html#sub:flat_dir_resolver // flatDir { // dir 'libs' // } } dependencies { // Specify the version of Minecraft to use. // Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact. // The "userdev" classifier will be requested and setup by ForgeGradle. // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. minecraft "net.minecraftforge:forge:${minecraft_version}-${forge_version}" // Forge 1.21.6+ uses EventBus 7, which shifts most of its runtime validation to compile-time via an annotation processor // to improve performance in production environments. This line is required to enable said compile-time validation // in your development environment, helping you catch issues early. annotationProcessor 'net.minecraftforge:eventbus-validator:7.0-beta.10' // Example mod dependency with JEI // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime // compileOnly "mezz.jei:jei-${mc_version}-common-api:${jei_version}" // compileOnly "mezz.jei:jei-${mc_version}-forge-api:${jei_version}" // runtimeOnly "mezz.jei:jei-${mc_version}-forge:${jei_version}" // Example mod dependency using a mod jar from ./libs with a flat dir repository // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar // The group id is ignored when searching -- in this case, it is "blank" // 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 } // This block of code expands all declared replace properties in the specified resource targets. // A missing property will result in an error. Properties are expanded using ${} Groovy notation. // When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html tasks.named('processResources', ProcessResources) { var 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, ] inputs.properties replaceProperties filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { expand replaceProperties + [project: project] } } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar) { 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 ]) // attributes['MixinConfigs'] = "${mod_id}.mixins.json" } } // Example configuration to allow publishing using the maven-publish plugin publishing { publications { register('mavenJava', MavenPublication) { artifact jar } } repositories { maven { url ="file://${project.projectDir}/mcmodsrepo" } } } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } // IntelliJ no longer downloads javadocs and sources by default, this tells Gradle to force IntelliJ to do it. idea.module { downloadJavadoc = downloadSources = true } eclipse { // Run everytime eclipse builds the code //autoBuildTasks genEclipseRuns // Run when importing the project synchronizationTasks 'genEclipseRuns' } // Merge the resources and classes into the same directory, because Java expects modules to be in a single directory. // And if we have it in multiple we have to do performance intensive hacks like having the UnionFileSystem // This will eventually be migrated to ForgeGradle so modders don't need to manually do it. But that is later. sourceSets.each { def dir = layout.buildDirectory.dir("sourcesSets/$it.name") it.output.resourcesDir = dir it.java.destinationDirectory = dir }
08-24
先看效果: https://pan.quark.cn/s/c7070e7537b1 [!NOTE] 每到答辩季我就会喜获stars,谢谢大家的支持! 欢迎推广传播本repo(https://.com/atomiechen/THU-PPT-Theme),也欢迎贡献变体,提供更多选择 清华简约主题PPT模板 Repo stars 2020年春夏之交,答辩期间很多同学都在寻找清华主题的答辩模板。 一方面有使用LaTeX制作Beamer的模板(见Overleaf上的模板THU Beamer Theme),另一方面民间也存在着一些PPT模板。 很多人可能不适应Beamer的使用(主要是内容和排版设计不是可见即所得,定制有门槛),以及我找到的PPT模板也都不太好使(要么图案设计太复杂、不好看,要么没有制作成PPT母版导致每次使用都要复制粘贴+微调,不方便)。 我制作了清华简约主题的PPT模板,后续有新的设计我会逐渐加入,也欢迎有兴趣有想法的朋友们添砖加瓦! 内容 所有模板均为 文件。 此外也提供转换脚本用于 Pandoc自动生成PPTX。 各个版本的修改历史见 CHANGELOG.md。 下载 推荐直接从 Releases 下载最新发布版。 也可以在 仓库 单独下载所需文件。 效果 16:9比例,v1留边、v1顶边、v3留边白底、v3顶边白底: demo 16:9比例,其他风格模板:v1扁平、v2扁平、v1暗光 demo2 其他变体设计参见 variants/README.md。 使用方式 可以基于所提供的文件自行修改内容,也可以在新建的PPT文稿中应用该模板。 后者在 MS Office 2019 For Mac 的 PowerPoint 里的具体使用方式为:首先选择幻灯片尺...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值