mirror of
https://github.com/RoBaertschi/EnvironmentTech.git
synced 2025-04-19 23:03:28 +00:00
move to kotlin dsl and remove unused code
This commit is contained in:
parent
eda52283d6
commit
35f54c29ca
@ -1,75 +1,94 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java-library'
|
id ("java-library")
|
||||||
id 'eclipse'
|
id ("eclipse")
|
||||||
id 'idea'
|
id ("idea")
|
||||||
id 'maven-publish'
|
id ("maven-publish")
|
||||||
id 'net.neoforged.gradle.userdev' version '7.0.138'
|
id ("net.neoforged.gradle.userdev") version ("7.0.138")
|
||||||
}
|
}
|
||||||
|
|
||||||
version = mod_version
|
val minecraftVersion: String by project
|
||||||
group = mod_group_id
|
val minecraftVersionRange: String by project
|
||||||
|
val neoVersion: String by project
|
||||||
|
val neoVersionRange: String by project
|
||||||
|
val loaderVersionRange: String by project
|
||||||
|
|
||||||
|
val modId: String by project
|
||||||
|
val modName: String by project
|
||||||
|
val modLicense: String by project
|
||||||
|
val modVersion: String by project
|
||||||
|
val modGroupId: String by project
|
||||||
|
val modAuthors: String by project
|
||||||
|
val modDescription: String by project
|
||||||
|
|
||||||
|
version = modVersion
|
||||||
|
group = modGroupId
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
}
|
}
|
||||||
|
|
||||||
base {
|
base {
|
||||||
archivesName = mod_id
|
archivesName = modId
|
||||||
}
|
}
|
||||||
|
|
||||||
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
java.toolchain.languageVersion = JavaLanguageVersion.of(21)
|
||||||
|
|
||||||
//minecraft.accessTransformers.file rootProject.file('src/main/resources/META-INF/accesstransformer.cfg')
|
//minecraft.accessTransformers.file rootProject.file("src/main/resources/META-INF/accesstransformer.cfg")
|
||||||
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
//minecraft.accessTransformers.entry public net.minecraft.client.Minecraft textureManager # textureManager
|
||||||
|
|
||||||
// Default run configurations.
|
// Default run configurations.
|
||||||
// These can be tweaked, removed, or duplicated as needed.
|
// These can be tweaked, removed, or duplicated as needed.
|
||||||
runs {
|
runs {
|
||||||
// applies to all the run configs below
|
// applies to all the run configs below
|
||||||
|
|
||||||
configureEach {
|
configureEach {
|
||||||
// Recommended logging data for a userdev environment
|
// Recommended logging data for a userdev environment
|
||||||
// The markers can be added/remove as needed separated by commas.
|
// The markers can be added/remove as needed separated by commas.
|
||||||
// "SCAN": For mods scan.
|
// "SCAN": For mods scan.
|
||||||
// "REGISTRIES": For firing of registry events.
|
// "REGISTRIES": For firing of registry events.
|
||||||
// "REGISTRYDUMP": For getting the contents of all registries.
|
// "REGISTRYDUMP": For getting the contents of all registries.
|
||||||
systemProperty 'forge.logging.markers', 'REGISTRIES'
|
systemProperty ("forge.logging.markers", "REGISTRIES")
|
||||||
|
|
||||||
// Recommended logging level for the console
|
// Recommended logging level for the console
|
||||||
// You can set various levels here.
|
// You can set various levels here.
|
||||||
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
// Please read: https://stackoverflow.com/questions/2031163/when-to-use-the-different-log-levels
|
||||||
systemProperty 'forge.logging.console.level', 'debug'
|
systemProperty ("forge.logging.console.level", "debug")
|
||||||
|
|
||||||
modSource project.sourceSets.main
|
modSource (project.sourceSets["main"])
|
||||||
}
|
}
|
||||||
|
|
||||||
client {
|
create("client") {
|
||||||
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
// Comma-separated list of namespaces to load gametests from. Empty = all namespaces.
|
||||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
systemProperty ("forge.enabledGameTestNamespaces", modId)
|
||||||
}
|
}
|
||||||
|
|
||||||
server {
|
create("server") {
|
||||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
systemProperty ("forge.enabledGameTestNamespaces", modId)
|
||||||
programArgument '--nogui'
|
programArgument ("--nogui")
|
||||||
}
|
}
|
||||||
|
|
||||||
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
// This run config launches GameTestServer and runs all registered gametests, then exits.
|
||||||
// By default, the server will crash when no gametests are provided.
|
// 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.
|
// The gametest system is also enabled by default for other run configs under the /test command.
|
||||||
gameTestServer {
|
create("gameTestServer") {
|
||||||
systemProperty 'forge.enabledGameTestNamespaces', project.mod_id
|
systemProperty ("forge.enabledGameTestNamespaces", modId)
|
||||||
}
|
}
|
||||||
|
|
||||||
data {
|
create("data") {
|
||||||
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
// example of overriding the workingDirectory set in configureEach above, uncomment if you want to use it
|
||||||
// workingDirectory project.file('run-data')
|
// workingDirectory project.file("run-data")
|
||||||
|
|
||||||
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
// Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources.
|
||||||
programArguments.addAll '--mod', project.mod_id, '--all', '--output', file('src/generated/resources/').getAbsolutePath(), '--existing', file('src/main/resources/').getAbsolutePath()
|
programArguments.addAll ("--mod", modId, "--all", "--output", file("src/generated/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include resources generated by data generators.
|
// Include resources generated by data generators.
|
||||||
sourceSets.main.resources { srcDir 'src/generated/resources' }
|
sourceSets.main.configure {
|
||||||
|
resources {
|
||||||
|
srcDir("src/generated/resources")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@ -79,7 +98,7 @@ dependencies {
|
|||||||
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
|
// You can however also use the vanilla plugin (net.neoforged.gradle.vanilla) to use a version of Minecraft without the neoforge loader.
|
||||||
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
|
// And its provides the option to then use net.minecraft as the group, and one of; client, server or joined as the module name, plus the game version as version.
|
||||||
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
|
// For all intends and purposes: You can treat this dependency as if it is a normal library you would use.
|
||||||
implementation "net.neoforged:neoforge:${neo_version}"
|
implementation ("net.neoforged:neoforge:${neoVersion}")
|
||||||
|
|
||||||
// Example mod dependency with JEI
|
// Example mod dependency with JEI
|
||||||
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
// The JEI API is declared for compile time use, while the full JEI artifact is used at runtime
|
||||||
@ -107,37 +126,38 @@ dependencies {
|
|||||||
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
|
// 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.
|
// 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
|
// See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html
|
||||||
tasks.withType(ProcessResources).configureEach {
|
tasks.withType<ProcessResources>().configureEach {
|
||||||
var replaceProperties = [
|
val replaceProperties = mapOf(
|
||||||
minecraft_version : minecraft_version,
|
"minecraft_version" to minecraftVersion,
|
||||||
minecraft_version_range: minecraft_version_range,
|
"minecraft_version_range" to minecraftVersionRange,
|
||||||
neo_version : neo_version,
|
"neo_version" to neoVersion,
|
||||||
neo_version_range : neo_version_range,
|
"neo_version_range" to neoVersionRange,
|
||||||
loader_version_range : loader_version_range,
|
"loader_version_range" to loaderVersionRange,
|
||||||
mod_id : mod_id,
|
"mod_id" to modId,
|
||||||
mod_name : mod_name,
|
"mod_name" to modName,
|
||||||
mod_license : mod_license,
|
"mod_license" to modLicense,
|
||||||
mod_version : mod_version,
|
"mod_version" to modVersion,
|
||||||
mod_authors : mod_authors,
|
"mod_authors" to modAuthors,
|
||||||
mod_description : mod_description
|
"mod_description" to modDescription)
|
||||||
]
|
inputs.properties(replaceProperties)
|
||||||
inputs.properties replaceProperties
|
|
||||||
|
|
||||||
filesMatching(['META-INF/neoforge.mods.toml']) {
|
filesMatching("META-INF/neoforge.mods.toml") {
|
||||||
expand replaceProperties
|
expand(replaceProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Example configuration to allow publishing using the maven-publish plugin
|
// Example configuration to allow publishing using the maven-publish plugin
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
register('mavenJava', MavenPublication) {
|
register<MavenPublication>("mavenJava") {
|
||||||
from components.java
|
from (components["java"])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
|
|
||||||
maven {
|
maven {
|
||||||
url "file://${project.projectDir}/repo"
|
url = project.projectDir.toURI()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -145,7 +165,7 @@ publishing {
|
|||||||
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
// IDEA no longer automatically downloads sources/javadoc jars for dependencies, so we need to explicitly enable the behavior.
|
||||||
idea {
|
idea {
|
||||||
module {
|
module {
|
||||||
downloadSources = true
|
isDownloadJavadoc = true
|
||||||
downloadJavadoc = true
|
isDownloadSources = true
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -6,17 +6,17 @@ org.gradle.debug=false
|
|||||||
## Environment Properties
|
## Environment Properties
|
||||||
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
# You can find the latest versions here: https://projects.neoforged.net/neoforged/neoforge
|
||||||
# The Minecraft version must agree with the Neo version to get a valid artifact
|
# The Minecraft version must agree with the Neo version to get a valid artifact
|
||||||
minecraft_version=1.20.6
|
minecraftVersion=1.20.6
|
||||||
# The Minecraft version range can use any release version of Minecraft as bounds.
|
# The Minecraft version range can use any release version of Minecraft as bounds.
|
||||||
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
# Snapshots, pre-releases, and release candidates are not guaranteed to sort properly
|
||||||
# as they do not follow standard versioning conventions.
|
# as they do not follow standard versioning conventions.
|
||||||
minecraft_version_range=[1.20.6,1.21)
|
minecraftVersionRange=[1.20.6,1.21)
|
||||||
# The Neo version must agree with the Minecraft version to get a valid artifact
|
# The Neo version must agree with the Minecraft version to get a valid artifact
|
||||||
neo_version=20.6.100-beta
|
neoVersion=20.6.100-beta
|
||||||
# The Neo version range can use any version of Neo as bounds
|
# The Neo version range can use any version of Neo as bounds
|
||||||
neo_version_range=[20,)
|
neoVersionRange=[20,)
|
||||||
# The loader version range can only use the major version of FML as bounds
|
# The loader version range can only use the major version of FML as bounds
|
||||||
loader_version_range=[2,)
|
loaderVersionRange=[2,)
|
||||||
|
|
||||||
neogradle.subsystems.parchment.minecraftVersion=1.20.6
|
neogradle.subsystems.parchment.minecraftVersion=1.20.6
|
||||||
neogradle.subsystems.parchment.mappingsVersion=2024.05.01
|
neogradle.subsystems.parchment.mappingsVersion=2024.05.01
|
||||||
@ -25,18 +25,18 @@ neogradle.subsystems.parchment.mappingsVersion=2024.05.01
|
|||||||
|
|
||||||
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
# The unique mod identifier for the mod. Must be lowercase in English locale. Must fit the regex [a-z][a-z0-9_]{1,63}
|
||||||
# Must match the String constant located in the main mod class annotated with @Mod.
|
# Must match the String constant located in the main mod class annotated with @Mod.
|
||||||
mod_id=environmenttech
|
modId=environmenttech
|
||||||
# The human-readable display name for the mod.
|
# The human-readable display name for the mod.
|
||||||
mod_name=EnvironmentTech
|
modName=EnvironmentTech
|
||||||
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=MIT
|
modLicense=MIT
|
||||||
# The mod version. See https://semver.org/
|
# The mod version. See https://semver.org/
|
||||||
mod_version=1.0-SNAPSHOT
|
modVersion=1.0-SNAPSHOT
|
||||||
# The group ID for the mod. It is only important when publishing as an artifact to a Maven repository.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
mod_group_id=robaertschi
|
modGroupId=robaertschi
|
||||||
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
# The authors of the mod. This is a simple text string that is used for display purposes in the mod list.
|
||||||
mod_authors=RoBaertschi
|
modAuthors=RoBaertschi
|
||||||
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
# The description of the mod. This is a simple multiline text string that is used for display purposes in the mod list.
|
||||||
mod_description=
|
modDescription=
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
pluginManagement {
|
|
||||||
repositories {
|
|
||||||
mavenLocal()
|
|
||||||
gradlePluginPortal()
|
|
||||||
maven { url = 'https://maven.neoforged.net/releases' }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
plugins {
|
|
||||||
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0'
|
|
||||||
}
|
|
11
settings.gradle.kts
Normal file
11
settings.gradle.kts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
gradlePluginPortal()
|
||||||
|
maven ("https://maven.neoforged.net/releases")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins {
|
||||||
|
id ("org.gradle.toolchains.foojay-resolver-convention") version "0.8.0"
|
||||||
|
}
|
@ -2,7 +2,6 @@ package robaertschi.environmenttech.level.item;
|
|||||||
|
|
||||||
import net.minecraft.core.registries.Registries;
|
import net.minecraft.core.registries.Registries;
|
||||||
import net.minecraft.network.chat.Component;
|
import net.minecraft.network.chat.Component;
|
||||||
import net.minecraft.world.food.FoodProperties;
|
|
||||||
import net.minecraft.world.item.BlockItem;
|
import net.minecraft.world.item.BlockItem;
|
||||||
import net.minecraft.world.item.CreativeModeTab;
|
import net.minecraft.world.item.CreativeModeTab;
|
||||||
import net.minecraft.world.item.CreativeModeTabs;
|
import net.minecraft.world.item.CreativeModeTabs;
|
||||||
@ -20,29 +19,30 @@ import static robaertschi.environmenttech.level.block.ETBlocks.EXAMPLE_BLOCK;
|
|||||||
|
|
||||||
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
@EventBusSubscriber(bus = EventBusSubscriber.Bus.MOD)
|
||||||
public class ETItems {
|
public class ETItems {
|
||||||
// Create a Deferred Register to hold Items which will all be registered under the "environmenttech" namespace
|
|
||||||
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID);
|
public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(MODID);
|
||||||
// Create a Deferred Register to hold CreativeModeTabs which will all be registered under the "environmenttech" namespace
|
|
||||||
|
|
||||||
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
|
public static final DeferredRegister<CreativeModeTab> CREATIVE_MODE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, MODID);
|
||||||
|
|
||||||
|
|
||||||
// Creates a new BlockItem with the id "environmenttech:example_block", combining the namespace and path
|
|
||||||
public static final DeferredItem<BlockItem> EXAMPLE_BLOCK_ITEM = ITEMS.registerSimpleBlockItem("example_block", EXAMPLE_BLOCK);
|
public static final DeferredItem<BlockItem> EXAMPLE_BLOCK_ITEM = ITEMS.registerSimpleBlockItem("example_block", EXAMPLE_BLOCK);
|
||||||
|
|
||||||
// Creates a new food item with the id "environmenttech:example_id", nutrition 1 and saturation 2
|
public static final DeferredItem<EnvDetectorItem> ENV_DETECTOR_ITEM = ITEMS.registerItem("env_detector",
|
||||||
public static final DeferredItem<Item> EXAMPLE_ITEM = ITEMS.registerSimpleItem("example_item", new Item.Properties().food(new FoodProperties.Builder()
|
EnvDetectorItem::new,
|
||||||
.alwaysEdible().nutrition(1).saturationModifier(2f).build()));
|
new Item.Properties()
|
||||||
|
.stacksTo(1)
|
||||||
public static final DeferredItem<EnvDetectorItem> ENV_DETECTOR_ITEM = ITEMS.registerItem("env_detector", EnvDetectorItem::new, new Item.Properties().stacksTo(1).durability(10));
|
.durability(10)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> EXAMPLE_TAB = CREATIVE_MODE_TABS.register("example_tab", () -> CreativeModeTab.builder()
|
@SuppressWarnings("unused")
|
||||||
|
public static final DeferredHolder<CreativeModeTab, CreativeModeTab> CREATE_MODE_TAB = CREATIVE_MODE_TABS.register("environmenttech", () -> CreativeModeTab.builder()
|
||||||
.title(Component.translatable("itemGroup.environmenttech"))
|
.title(Component.translatable("itemGroup.environmenttech"))
|
||||||
.withTabsBefore(CreativeModeTabs.COMBAT)
|
.withTabsBefore(CreativeModeTabs.COMBAT)
|
||||||
.icon(() -> EXAMPLE_ITEM.get().getDefaultInstance())
|
.icon(() -> ENV_DETECTOR_ITEM.get().getDefaultInstance())
|
||||||
.displayItems((parameters, output) -> {
|
.displayItems((parameters, output) -> {
|
||||||
output.accept(EXAMPLE_ITEM.get()); // Add the example item to the tab. For your own tabs, this method is preferred over the event
|
|
||||||
output.accept(ENV_DETECTOR_ITEM.get());
|
output.accept(ENV_DETECTOR_ITEM.get());
|
||||||
|
output.accept(EXAMPLE_BLOCK_ITEM.get());
|
||||||
}).build());
|
}).build());
|
||||||
|
|
||||||
|
|
||||||
@ -53,12 +53,10 @@ public class ETItems {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unused")
|
||||||
@SubscribeEvent()
|
@SubscribeEvent()
|
||||||
// Add the example block item to the building blocks tab
|
// Add the example block item to the building blocks tab
|
||||||
public static void addCreative(BuildCreativeModeTabContentsEvent event)
|
public static void addCreative(BuildCreativeModeTabContentsEvent event)
|
||||||
{
|
{
|
||||||
if (event.getTabKey() == CreativeModeTabs.BUILDING_BLOCKS) {
|
|
||||||
event.accept(EXAMPLE_BLOCK_ITEM);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"item.environmenttech.env_detector": "ENV Detector",
|
||||||
|
|
||||||
|
"itemGroup.environmenttech": "Environment Tech"
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user