Compare commits

..

No commits in common. "1.21" and "1.20" have entirely different histories.
1.21 ... 1.20

2467 changed files with 43206 additions and 79042 deletions

2
.gitignore vendored
View File

@ -31,5 +31,3 @@ logs/
forge*changelog.txt forge*changelog.txt
shapegen_output.java shapegen_output.java
/runs
/.kotlin

View File

@ -1,21 +1,22 @@
# Overdrive That Matters # Overdrive That Matters
Minecraft tech-oriented mod with science fiction style, about matter, and energy, combined. Minecraft mod with science fiction style, about matter, and energy, combined.
### Required mods ### Required mods
* [Kotlin for Forge](https://www.curseforge.com/minecraft/mc-mods/kotlin-for-forge) or have Kotlin standard library in classpath (at least 2.0.0 is required) * [Kotlin for Forge](https://www.curseforge.com/minecraft/mc-mods/kotlin-for-forge) or have Kotlin standard library in classpath (at least 1.8.0 is required)
* [Koremods](https://beta.curseforge.com/minecraft/mc-mods/koremods)
### Recommended mods ### Recommended mods
* [Ferrite Core](https://www.curseforge.com/minecraft/mc-mods/ferritecore), reduces memory usage * [Ferrite Core](https://www.curseforge.com/minecraft/mc-mods/ferritecore), reduces memory usage
* In case of Overdrive That Matters, ***greatly*** reduces JVM heap bloat caused by model data being duplicated * In case of Overdrive That Matters, ***greatly*** reduces JVM heap bloat caused by model data being duplicated
* Better Random
### Mods with special compatibility code ### Mods with special compatibility code
* [JEI](https://www.curseforge.com/minecraft/mc-mods/jei) * [JEI](https://www.curseforge.com/minecraft/mc-mods/jei)
* [Mekanism](https://www.curseforge.com/minecraft/mc-mods/Mekanism)
* [Curios](https://www.curseforge.com/minecraft/mc-mods/curios) * [Curios](https://www.curseforge.com/minecraft/mc-mods/curios)
* [Cosmetic Armor Reworked](https://www.curseforge.com/minecraft/mc-mods/cosmetic-armor-reworked) * [Cosmetic Armor Reworked](https://www.curseforge.com/minecraft/mc-mods/cosmetic-armor-reworked)
@ -44,9 +45,9 @@ to avoid bloating git history with generated blobs.
## License ## License
Unless otherwise stated in [NOTICE](NOTICE.md), assets in mod are licensed under **2-Clause BSD** Unless otherwise stated in [NOTICE](NOTICE.md), material in mod is licensed under **2-Clause BSD**
Copyright 2021-Present DBotThePony, GearShocky, YuRaNnNzZZ, Overdrive That Matters Contributors Copyright 2021-Present DBotThePony, GearShocky, Overdrive That Matters Contributors
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

View File

@ -1,30 +1,35 @@
import groovy.lang.Closure
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.Date import java.util.Date
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo import java.util.UUID
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
val mod_version: String by project val mod_version: String by project
val mc_version: String by project val mc_version: String by project
val parchment_version: String by project
val forge_version: String by project val forge_version: String by project
val mod_id: String by project val mod_id: String by project
val handle_deps: String by project val handle_deps: String by project
val use_commit_hash_in_version: String by project val use_commit_hash_in_version: String by project
val handleDeps = handle_deps.toBoolean() val handleDeps = handle_deps.toBoolean()
val caffeine_cache_version: String by project
plugins { plugins {
java java
kotlin kotlin
idea
`maven-publish` `maven-publish`
id("net.neoforged.gradle.userdev") id("net.minecraftforge.gradle")
id("net.neoforged.gradle.mixin") id("org.spongepowered.mixin")
id("org.parchmentmc.librarian.forgegradle")
} }
data class GitInfo(val version: String, val tag: String, val buildNumber: String) { configurations {
create("library") // non-mod libraries
create("klibrary") // kotlin libs
get("implementation").extendsFrom(get("library"), get("klibrary"))
}
data class GitInfo(val version: String, val count: String, val tag: String, val buildNumber: String) {
// val tagIsVersion: Boolean get() = tag != "" && tag.matches(Regex("v[0-9]+\\.[0-9]\\.[0-9]")) // val tagIsVersion: Boolean get() = tag != "" && tag.matches(Regex("v[0-9]+\\.[0-9]\\.[0-9]"))
val publishVersion: String get() { val publishVersion: String get() {
@ -51,11 +56,18 @@ data class GitInfo(val version: String, val tag: String, val buildNumber: String
} }
val modVersion: String get() { val modVersion: String get() {
return if (buildNumber != "") "$mod_version.$buildNumber" else mod_version if (tag != "")
return mod_version
if (version != "") {
return "$mod_version-SNAPSHOT-$version"
} else {
return "$mod_version-SNAPSHOT"
}
} }
} }
val gitVersion = getCommitVersion() ?: GitInfo("", "", "") val gitVersion = getCommitVersion() ?: GitInfo("", "", "", "")
version = gitVersion.modVersion version = gitVersion.modVersion
group = "ru.dbotthepony" group = "ru.dbotthepony"
@ -64,6 +76,7 @@ fun getCommitVersion(): GitInfo? {
try { try {
val versionStream = FastByteArrayOutputStream() val versionStream = FastByteArrayOutputStream()
val tagStream = FastByteArrayOutputStream() val tagStream = FastByteArrayOutputStream()
val countStream = FastByteArrayOutputStream()
val gotVersion = exec { val gotVersion = exec {
commandLine("git", "rev-parse", "--short", "HEAD") commandLine("git", "rev-parse", "--short", "HEAD")
@ -71,20 +84,27 @@ fun getCommitVersion(): GitInfo? {
standardOutput = versionStream standardOutput = versionStream
}.exitValue == 0 }.exitValue == 0
val gotCount = exec {
commandLine("git", "rev-list", "--count", "HEAD")
workingDir(".")
standardOutput = countStream
}.exitValue == 0
val gotTag = exec { val gotTag = exec {
commandLine("git", "tag", "--points-at", "HEAD") commandLine("git", "tag", "--points-at", "HEAD")
workingDir(".") workingDir(".")
standardOutput = tagStream standardOutput = tagStream
}.exitValue == 0 }.exitValue == 0
if (!gotVersion || !gotTag) { if (!gotVersion || !gotCount || !gotTag) {
return null return null
} }
val version = versionStream.array.copyOfRange(0, versionStream.length).toString(Charsets.UTF_8).trim() val version = versionStream.array.copyOfRange(0, versionStream.length).toString(Charsets.UTF_8).trim()
val tag = tagStream.array.copyOfRange(0, tagStream.length).toString(Charsets.UTF_8).trim() val tag = tagStream.array.copyOfRange(0, tagStream.length).toString(Charsets.UTF_8).trim()
val count = countStream.array.copyOfRange(0, countStream.length).toString(Charsets.UTF_8).trim()
return GitInfo(version, tag, System.getenv("BUILD_NUMBER") ?: "") return GitInfo(version, count, tag, System.getenv("BUILD_NUMBER") ?: "")
} catch(err: Throwable) { } catch(err: Throwable) {
println("Error getting git version") println("Error getting git version")
println(err) println(err)
@ -93,13 +113,13 @@ fun getCommitVersion(): GitInfo? {
return null return null
} }
java.toolchain.languageVersion.set(JavaLanguageVersion.of(21)) java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
println("Targeting Java ${java.toolchain.languageVersion.get()}") println("Targeting Java ${java.toolchain.languageVersion.get()}")
tasks.withType(KotlinCompile::class.java) { tasks.withType(KotlinCompile::class.java) {
compilerOptions { kotlinOptions {
freeCompilerArgs = listOf("-Xjvm-default=all") freeCompilerArgs = listOf("-Xjvm-default=all")
jvmTarget.set(JvmTarget.JVM_21) jvmTarget = java.toolchain.languageVersion.get().toString()
} }
} }
@ -110,9 +130,7 @@ tasks.withType(JavaCompile::class.java) {
sourceSets { sourceSets {
create("data") { create("data") {
compileClasspath += sourceSets["main"].output compileClasspath += sourceSets["main"].output
compileClasspath += sourceSets["main"].compileClasspath
runtimeClasspath += sourceSets["main"].output runtimeClasspath += sourceSets["main"].output
runtimeClasspath += sourceSets["main"].runtimeClasspath
} }
this["main"].resources { this["main"].resources {
@ -123,119 +141,101 @@ sourceSets {
tasks.test { tasks.test {
useJUnitPlatform() useJUnitPlatform()
maxHeapSize = "4G"
} }
configurations {
create("embeddedLibs")
}
jarJar.enable()
dependencies { dependencies {
val jupiter_version: String by project val jupiter_version: String by project
val kotlin_version: String by project
val kotlin_for_forge_version: String by project val kotlin_for_forge_version: String by project
val kotlin_coroutines_version: String by project
val kotlin_serialization_version: String by project
val mixin_version: String by project val mixin_version: String by project
val kommons_version: String by project
implementation("net.neoforged:neoforge:$forge_version") minecraft("net.minecraftforge:forge:$mc_version-$forge_version")
testImplementation("org.junit.jupiter:junit-jupiter:${jupiter_version}") testImplementation("org.junit.jupiter:junit-jupiter:${jupiter_version}")
implementation("thedarkcolour:kotlinforforge-neoforge:$kotlin_for_forge_version") implementation("thedarkcolour:kotlinforforge:$kotlin_for_forge_version")
jarJar(implementation("com.github.ben-manes.caffeine:caffeine:[$caffeine_cache_version,)")!!) fun library(notation: Any) { this.add("library", notation) }
fun klibrary(notation: Any) { this.add("klibrary", notation) }
jarJar(implementation("ru.dbotthepony.kommons:kommons:[$kommons_version,)") { setTransitive(false) }) val excludeKGroup = closureOf<Any> {
jarJar(implementation("ru.dbotthepony.kommons:kommons-gson:[$kommons_version,)") { setTransitive(false) }) (this as ExternalModuleDependency).exclude(group = "org.jetbrains", module = "annotations")
jarJar(implementation("ru.dbotthepony.kommons:kommons-guava:[$kommons_version,)") { setTransitive(false) }) } as Closure<Any>
klibrary(create("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version", excludeKGroup))
klibrary(create("org.jetbrains.kotlin:kotlin-reflect:$kotlin_version", excludeKGroup))
klibrary(create("org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version", excludeKGroup))
klibrary(create("org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$kotlin_coroutines_version", excludeKGroup))
klibrary(create("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialization_version", excludeKGroup))
compileOnly("yalter.mousetweaks:MouseTweaks:2.23:api") compileOnly("yalter.mousetweaks:MouseTweaks:2.23:api")
annotationProcessor("org.spongepowered:mixin:${mixin_version}:processor") annotationProcessor("org.spongepowered:mixin:${mixin_version}:processor")
if (handleDeps) { if (handleDeps) {
val jei_version: String by project val jei_version: String by project
val mekanism_version: String by project
val cosmetic_armor_reworked_id: String by project val cosmetic_armor_reworked_id: String by project
val jade_id: String by project val jade_id: String by project
val configured_id: String by project val configured_id: String by project
val curios_version: String by project val curios_version: String by project
val jei_mc_version: String by project val jei_mc_version: String by project
val curios_mc_version: String by project val curios_mc_version: String by project
val resourceful_lib_id: String by project
val resourceful_config_id: String by project
val botarium_id: String by project
val ad_astra_id: String by project val ad_astra_id: String by project
val worldedit_id: String by project
val item_borders_id: String by project
val iceberg_id: String by project
val prism_lib_id: String by project
val cloth_config_version: String by project
val condensed_creative_version: String by project
val mekanism_version: String by project
compileOnly("top.theillusivec4.curios:curios-neoforge:${curios_version}+${curios_mc_version}") compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_mc_version}"))
implementation("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id") compileOnly(fg.deobf("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id"))
compileOnly("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}") compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}"))
compileOnly("mezz.jei:jei-${jei_mc_version}-neoforge-api:${jei_version}") compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-forge-api:${jei_version}"))
runtimeOnly("mezz.jei:jei-${jei_mc_version}-neoforge:${jei_version}") runtimeOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-forge:${jei_version}"))
// runtimeOnly("ru.dbotthepony:particle-collider:0.4.5") runtimeOnly(fg.deobf("curse.maven:jade-324717:${jade_id}"))
//runtimeOnly(fg.deobf("curse.maven:configured-457570:${configured_id}"))
implementation("curse.maven:jade-324717:${jade_id}") compileOnly(fg.deobf("curse.maven:ad-astra-635042:${ad_astra_id}"))
//runtimeOnly("curse.maven:configured-457570:${configured_id}") compileOnly(fg.deobf("curse.maven:resourceful-lib-570073:4574449"))
compileOnly(fg.deobf("curse.maven:resourceful-config-714059:4444198"))
compileOnly(fg.deobf("curse.maven:botarium-704113:4416456"))
compileOnly("curse.maven:resourceful-lib-570073:${resourceful_lib_id}") // runtimeOnly(fg.deobf("curse.maven:worldedit-225608:${worldedit_fileid}"))
compileOnly("curse.maven:resourceful-config-714059:${resourceful_config_id}") // runtimeOnly(fg.deobf("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}"))
compileOnly("curse.maven:botarium-704113:${botarium_id}")
compileOnly("curse.maven:ad-astra-635042:${ad_astra_id}")
runtimeOnly("curse.maven:worldedit-225608:${worldedit_id}")
runtimeOnly("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}") compileOnly(fg.deobf("mekanism:Mekanism:${mekanism_version}:all"))
implementation("io.wispforest:condensed_creative-neoforge:${condensed_creative_version}")
compileOnly("curse.maven:item-borders-513769:${item_borders_id}") // runtimeOnly(fg.deobf("curse.maven:cyclops-core-232758:4392602"))
// implementation("curse.maven:item-borders-513769:${item_borders_id}") // runtimeOnly(fg.deobf("curse.maven:integrated-dynamics-236307:4391535"))
// runtimeOnly("curse.maven:iceberg-520110:${iceberg_id}") // runtimeOnly(fg.deobf("curse.maven:integrated-crafting-287357:4391487"))
// runtimeOnly("curse.maven:prism-lib-638111:${prism_lib_id}") // runtimeOnly(fg.deobf("curse.maven:integrated-terminals-295910:4400924"))
// runtimeOnly(fg.deobf("curse.maven:common-capabilities-247007:4391468"))
// runtimeOnly("curse.maven:worldedit-225608:${worldedit_fileid}") // runtimeOnly(fg.deobf("curse.maven:integrated-tunnels-251389:4344632"))
// runtimeOnly("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}")
// runtimeOnly("curse.maven:cyclops-core-232758:4392602")
// runtimeOnly("curse.maven:integrated-dynamics-236307:4391535")
// runtimeOnly("curse.maven:integrated-crafting-287357:4391487")
// runtimeOnly("curse.maven:integrated-terminals-295910:4400924")
// runtimeOnly("curse.maven:common-capabilities-247007:4391468")
// runtimeOnly("curse.maven:integrated-tunnels-251389:4344632")
implementation("mekanism:Mekanism:${mc_version}-${mekanism_version}")
implementation("curse.maven:iron-chests-228756:5491156")
implementation("curse.maven:iron-shulker-boxes-314911:5491246")
} }
} }
configurations {
getByName("dataImplementation").extendsFrom(getByName("implementation"))
getByName("library").resolutionStrategy.cacheChangingModulesFor(10, "minutes")
}
minecraft { minecraft {
accessTransformers { val use_parchment: String by project
files("src/main/resources/META-INF/accesstransformer.cfg")
if (use_parchment.toBoolean()) {
mappings("parchment", parchment_version)
} else {
mappings("official", mc_version)
} }
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
runs { runs {
configureEach { create("client") {
// "SCAN": For mods scan. mods {
// "REGISTRIES": For firing of registry events. create(mod_id) {
// "REGISTRYDUMP": For getting the contents of all registries. source(sourceSets["main"])
systemProperty("forge.logging.markers", "REGISTRIES")
// Log4j console level
systemProperty("forge.logging.console.level", "debug")
dependencies {
runtime("com.github.ben-manes.caffeine:caffeine:[$caffeine_cache_version,)")
} }
} }
getByName("client") {
val usernameStream = FastByteArrayOutputStream() val usernameStream = FastByteArrayOutputStream()
val gotUsername = exec { val gotUsername = exec {
@ -248,32 +248,63 @@ minecraft {
val originalUsername = usernameStream.array.copyOfRange(0, usernameStream.length).toString(Charsets.UTF_8).trim() val originalUsername = usernameStream.array.copyOfRange(0, usernameStream.length).toString(Charsets.UTF_8).trim()
if (originalUsername.isNotEmpty()) { if (originalUsername.isNotEmpty()) {
programArguments.addAll("--username", originalUsername) args("--username", originalUsername)
} else { } else {
programArguments.addAll("--username", "Dev_${System.getProperty("user.name")}") args("--username", "Dev_${System.getProperty("user.name")}")
} }
} else { } else {
programArguments.addAll("--username", "Dev_${System.getProperty("user.name")}") args("--username", "Dev_${System.getProperty("user.name")}")
} }
} }
getByName("server") { create("server") {
programArguments.addAll("nogui") mods {
create(mod_id) {
source(sourceSets["main"])
}
} }
getByName("data") { args("nogui")
programArguments.addAll("--mod", mod_id, "--all", "--output", file("src/data/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath) }
modSources(sourceSets["main"], sourceSets["data"]) create("data") {
args("--mod", mod_id, "--all", "--output", file("src/data/resources/"), "--existing", file("src/main/resources/"))
mods {
create(mod_id) {
sources(sourceSets["main"], sourceSets["data"])
}
}
} }
} }
} }
mixin { mixin {
add(sourceSets.main.get(), "$mod_id.refmap.json")
config("$mod_id.mixins.json") config("$mod_id.mixins.json")
config("$mod_id.ironchest.mixins.json") config("$mod_id.ad_astra.mixins.json")
config("$mod_id.ironshulkerbox.mixins.json") }
// config("$mod_id.ad_astra.mixins.json")
minecraft.runs.all {
workingDirectory = project.file("run").absolutePath
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
property("forge.logging.markers", "REGISTRIES")
// Log4j console level
property("forge.logging.console.level", "debug")
lazyToken("minecraft_classpath") {
configurations["library"]
.copyRecursive()
.resolve()
.map { it.absolutePath }
.toMutableList()
.also { it.addAll(configurations["klibrary"].copyRecursive().resolve().map { it.absolutePath }) }
.joinToString(File.pathSeparator)
}
} }
repositories { repositories {
@ -287,20 +318,9 @@ repositories {
content { content {
includeGroup("yalter.mousetweaks") includeGroup("yalter.mousetweaks")
includeGroup("mekanism")
includeGroup("lain.mods.cos") includeGroup("lain.mods.cos")
includeGroup("at.ridgo8.moreoverlays") includeGroup("at.ridgo8.moreoverlays")
includeGroup("ru.dbotthepony")
includeGroup("curse.maven")
includeGroup("ru.dbotthepony.kommons")
}
}
maven(url = "https://maven.neoforged.net/releases") {
name = "Neoforge"
content {
includeGroup("net.neoforged.gradle")
includeGroup("net.neoforged")
} }
} }
@ -315,6 +335,14 @@ repositories {
} }
} }
maven {
url = uri("https://www.cursemaven.com")
content {
includeGroup("curse.maven")
}
}
maven { maven {
name = "Jared's Maven" name = "Jared's Maven"
url = uri("https://maven.blamejared.com/") url = uri("https://maven.blamejared.com/")
@ -325,37 +353,13 @@ repositories {
} }
maven { maven {
url = uri("https://maven.octo-studios.com/releases") url = uri("https://maven.theillusivec4.top/")
content { content {
includeGroup("top.theillusivec4.curios") includeGroup("top.theillusivec4.curios")
} }
} }
maven {
url = uri("https://maven.shedaniel.me/")
content {
includeGroup("me.shedaniel.cloth")
}
}
maven {
url = uri("https://maven.wispforest.io")
content {
includeGroup("io.wispforest")
}
}
maven {
url = uri("https://modmaven.dev/")
content {
includeGroup("mekanism")
}
}
// mavenCentral() // mavenCentral()
} }
@ -373,38 +377,27 @@ fun org.gradle.jvm.tasks.Jar.attachManifest() {
} }
} }
// Example configuration to allow publishing using the maven-publish plugin
// This is the preferred method to reobfuscate your jar file
tasks.jar.configure { tasks.jar.configure {
from(configurations["library"].map { if (it.isDirectory) it else zipTree(it) })
finalizedBy("reobfJar")
attachManifest() attachManifest()
archiveClassifier.set("slim")
archiveVersion.set(gitVersion.jarName) archiveVersion.set(gitVersion.jarName)
} }
tasks.jarJar.configure {
archiveClassifier.set("")
archiveVersion.set(gitVersion.jarName)
}
tasks.assemble.configure {
dependsOn(tasks.jarJar)
}
tasks.withType(ProcessResources::class.java) {
val replaceProperties = mapOf(
"mc_version" to mc_version,
"mod_version" to gitVersion.modVersion
)
inputs.properties(replaceProperties)
filesMatching(arrayListOf("META-INF/neoforge.mods.toml", "pack.mcmeta")) {
expand(replaceProperties)
}
}
tasks { tasks {
create("sourceJar", org.gradle.jvm.tasks.Jar::class.java) { create("sourceJar", org.gradle.jvm.tasks.Jar::class.java) {
archiveClassifier.set("sources") archiveClassifier.set("sources")
from(sourceSets.main.get().allSource) from(sourceSets.main.get().allSource)
} }
create("deobfJar", org.gradle.jvm.tasks.Jar::class.java) {
archiveClassifier.set("deobf")
from(configurations["library"].map { if (it.isDirectory) it else zipTree(it) })
from(sourceSets.main.get().output)
attachManifest()
}
} }
if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword") && project.hasProperty("mavenUrl")) { if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword") && project.hasProperty("mavenUrl")) {
@ -418,6 +411,7 @@ if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword") &&
// from(components["java"]) // from(components["java"])
artifact(tasks["jar"]) artifact(tasks["jar"])
artifact(tasks["sourceJar"]) artifact(tasks["sourceJar"])
artifact(tasks["deobfJar"])
version = gitVersion.publishVersion version = gitVersion.publishVersion
@ -447,9 +441,20 @@ if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword") &&
} }
} }
idea { // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing
module { // publish.dependsOn("reobfJar")
isDownloadSources = true
isDownloadJavadoc = true /*
publishing {
publications {
mavenJava(MavenPublication) {
artifact jar
}
}
repositories {
maven {
url "file://${project.projectDir}/mcmodsrepo"
}
} }
} }
*/

View File

@ -48,24 +48,21 @@ for (const colorA of colors) {
const magick = child_process.spawn('magick', [ const magick = child_process.spawn('magick', [
'convert', 'convert',
'-compose', 'Multiply',
'-size', `${width}x${height}`, '-size', `${width}x${height}`,
'(', '(',
`${root_main}${texA}.png`, `${root_main}${texA}.png`,
`xc:rgb(${rgbA[0]}, ${rgbA[1]}, ${rgbA[2]})`, `xc:rgb(${rgbA[0]}, ${rgbA[1]}, ${rgbA[2]})`,
'-compose', 'Multiply',
'-composite', '-composite',
')', ')',
'(', '(',
`${root_main}${texB}.png`, `${root_main}${texB}.png`,
`xc:rgb(${rgbB[0]}, ${rgbB[1]}, ${rgbB[2]})`, `xc:rgb(${rgbB[0]}, ${rgbB[1]}, ${rgbB[2]})`,
'-channel', 'rgb',
'-compose', 'Multiply',
'-composite', '-composite',
')', ')',
'-channel', 'rgba',
'-compose', 'Over', '-compose', 'Over',
'-composite', '-composite',

View File

@ -1,72 +0,0 @@
const args = process.argv.slice(2)
if (args.length < 2) {
console.error('Usage: node base_with_mask.js <base_name> <mask_name> [subfolder]\n')
console.error('If subfolder specified, resulting file name will contain only color name\n')
console.error('Subfolder is relative to base texture path\n')
process.exit(2)
}
const fs = require('fs')
const {colorsWithWhite, rootFolder, splitName, getSize} = require('./include.js')
const child_process = require('child_process');
(async function() {
const baseTexture = args[0]
const maskTexture = args[1]
const subfolder = args[2] ?? ''
const fBase = `${rootFolder}${baseTexture}.png`
const fMask = `${rootFolder}${maskTexture}.png`
if (!fs.existsSync(fBase)) {
process.stderr.write(`${fBase} does not exist\n`)
process.exit(1)
}
if (!fs.existsSync(fMask)) {
process.stderr.write(`${fMask} does not exist\n`)
process.exit(1)
}
const [fileName, _, fullBaseFolder] = splitName(baseTexture)
const bSize = (await getSize(fBase))[2]
const mSize = (await getSize(fMask))[2]
if (subfolder !== '') {
fs.mkdirSync(`${fullBaseFolder}/${subfolder}`, {recursive: true})
}
if (bSize != mSize) {
process.stderr.write(`${fBase} has size of ${bSize}, ${fMask} has size of ${mSize}!\n`)
process.exit(3)
}
for (const [name, _, xc] of colorsWithWhite) {
const outputFilename = subfolder === '' ? `${fullBaseFolder}/${fileName}_${name}.png` : `${fullBaseFolder}/${subfolder}/${name}.png`
const magick = child_process.spawn('magick', [
'convert',
fBase,
'(',
fMask,
'-size', bSize,
xc,
'-channel', 'rgb',
'-compose', 'Multiply',
'-composite',
')',
'-compose', 'Over',
'-composite',
outputFilename])
magick.stdout.pipe(process.stdout)
magick.stderr.pipe(process.stderr)
}
})();

View File

@ -1,4 +0,0 @@
#!/bin/bash
node ./base_with_mask.js block/decorative/computer_base block/decorative/computer_base_mask computer_base
node ./base_with_mask.js block/decorative/computer_screen block/decorative/computer_screen_mask computer_screen

View File

@ -1,3 +0,0 @@
#!/bin/bash
node ./base_with_mask.js block/essence_storage block/essence_storage_mask essence_storage

View File

@ -1,76 +0,0 @@
const colors = [
['orange', [245, 116, 16]],
['magenta', [186, 63, 175]],
['light_blue', [59, 180, 219]],
['yellow', [252, 199, 36]],
['lime', [111, 187, 24]],
['pink', [243, 139, 170]],
['gray', [62, 66, 70]],
['light_gray', [140, 140, 131]],
['cyan', [22, 134, 145]],
['purple', [116, 38, 169]],
['blue', [51, 53, 155]],
['brown', [114, 71, 40]],
['green', [84, 109, 28]],
['red', [156, 37, 34]],
['black', [31, 31, 35]],
]
const white = ['white', [235, 235, 235]]
const colorsWithWhite = [...colors]
colorsWithWhite.push(white)
function addRgbString(values) {
for (const row of values) {
const rgb = row[1]
row.push(`xc:rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`)
}
}
addRgbString(colors)
addRgbString(colorsWithWhite)
const rootFolder = '../src/main/resources/assets/overdrive_that_matters/textures/'
const child_process = require('child_process')
process.stdout.setMaxListeners(900)
process.stderr.setMaxListeners(900)
async function getSize(path) {
const identify = child_process.spawn('magick', [
'identify',
path,
])
identify.stderr.pipe(process.stderr)
const chunks = []
identify.stdout.on('data', (a) => chunks.push(a))
await new Promise((resolve) => {
identify.on('close', () => resolve())
})
const chunk = chunks[0].toString('utf-8')
const size = chunk.match(/PNG ([0-9]+)x([0-9]+)/)
const width = parseInt(size[1])
const height = parseInt(size[2])
return [width, height, `${width}x${height}`]
}
function splitName(name) {
const splitted = name.split('/')
const fileName = splitted.pop()
const baseFolder = splitted.join('/')
const fullBaseFolder = `${rootFolder}${baseFolder}`
return [fileName, baseFolder, fullBaseFolder, fileName.indexOf('_white') == -1 ? colorsWithWhite : colors]
}
exports.colors = colors
exports.colorsWithWhite = colorsWithWhite
exports.rootFolder = rootFolder
exports.splitName = splitName
exports.getSize = getSize

View File

@ -1,5 +0,0 @@
#!/bin/bash
node ./base_with_mask.js block/matter_replicator_base block/matter_replicator_base_mask matter_replicator_base
node ./base_with_mask.js block/matter_replicator block/matter_replicator_mask matter_replicator

View File

@ -1,4 +0,0 @@
#!/bin/bash
node ./base_with_mask.js block/tritanium_anvil block/tritanium_anvil_mask tritanium_anvil
node ./base_with_mask.js block/tritanium_anvil_top block/tritanium_anvil_top_mask tritanium_anvil_top

View File

@ -1,5 +0,0 @@
#!/bin/bash
node ./base_with_mask.js block/decorative/tritanium_door_top block/decorative/tritanium_door_color_top
node ./base_with_mask.js block/decorative/tritanium_door_bottom block/decorative/tritanium_door_color_bottom

56
color_doors.js Normal file
View File

@ -0,0 +1,56 @@
'use strict';
const fs = require('fs')
const root_main = './src/main/resources/assets/overdrive_that_matters/textures/block/decorative/'
const child_process = require('child_process')
const colors = [
['orange', [245, 116, 16]],
['magenta', [186, 63, 175]],
['light_blue', [59, 180, 219]],
['yellow', [252, 199, 36]],
['lime', [111, 187, 24]],
['pink', [243, 139, 170]],
['gray', [62, 66, 70]],
['light_gray', [140, 140, 131]],
['cyan', [22, 134, 145]],
['purple', [116, 38, 169]],
['blue', [51, 53, 155]],
['brown', [114, 71, 40]],
['green', [84, 109, 28]],
['red', [156, 37, 34]],
['black', [31, 31, 35]],
['white', [235, 235, 235]],
]
process.stderr.setMaxListeners(40)
process.stdout.setMaxListeners(40);
(async function() {
for (const [base, overlay, nameBase] of [['tritanium_door_base_top', 'tritanium_door_color_top', 'tritanium_door_top'], ['tritanium_door_base_bottom', 'tritanium_door_color_bottom', 'tritanium_door_bottom']]) {
for (const [name, rgb] of colors) {
const magick = child_process.spawn('magick', [
'convert',
`${root_main}${base}.png`,
'(',
`${root_main}${overlay}.png`,
'-size', '16x16',
`xc:rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`,
'-channel', 'rgb',
'-compose', 'Multiply',
'-composite',
')',
'-compose', 'Over',
'-composite',
`${root_main}/${nameBase}_${name}.png`])
magick.stdout.pipe(process.stdout)
magick.stderr.pipe(process.stderr)
}
}
})()

View File

@ -6,44 +6,33 @@ kotlin.stdlib.default.dependency=false
org.gradle.vfs.watch=true org.gradle.vfs.watch=true
mod_id=overdrive_that_matters mod_id=overdrive_that_matters
mod_version=1.5 mod_version=1.3
use_commit_hash_in_version=true use_commit_hash_in_version=true
mc_version=1.21.1 mc_version=1.20
jei_mc_version=1.21.1 use_parchment=false
curios_mc_version=1.21 parchment_version=2023.03.12-1.19.3
jei_mc_version=1.20
curios_mc_version=1.20
forge_gradle_version=7.0.153 forge_gradle_version=[6.0,6.2)
forge_version=21.1.21 forge_version=46.0.10
mixingradle_version=0.7.33 mixingradle_version=0.7.33
mixin_version=0.8.5 mixin_version=0.8.5
neogradle.subsystems.parchment.minecraftVersion=1.21.1 jei_version=14.0.0.5
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
kommons_version=3.9.1
caffeine_cache_version=3.1.5
jei_version=19.16.4.171
jupiter_version=5.9.2 jupiter_version=5.9.2
curios_version=9.0.5 mekanism_version=1.19.2-10.3.5.homebaked
cosmetic_armor_reworked_id=5610814 curios_version=5.2.0-beta.2
ad_astra_id=4594155 cosmetic_armor_reworked_id=4575609
botarium_id=4594094 ad_astra_id=4452010
resourceful_lib_id=4598948 jade_id=4573193
resourceful_config_id=4576455
jade_id=5591256
configured_id=4462894 configured_id=4462894
worldedit_id=5830452
item_borders_id=5591010
iceberg_id=5750025
prism_lib_id=5625115
cloth_config_version=15.0.130
condensed_creative_version=3.4.1+1.21
mekanism_version=10.7.7.64
kotlin_for_forge_version=5.5.0 kotlin_for_forge_version=3.1.0
kotlin_version=2.0.10 kotlin_version=1.8.0
kotlin_coroutines_version=1.6.0
kotlin_serialization_version=1.3.2
handle_deps=true handle_deps=true

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000 networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists

35
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# #
# Copyright © 2015-2021 the original authors. # Copyright © 2015-2021 the original authors.
# #
# Licensed under the Apache License, Version 2.0 (the "License"); # Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License. # you may not use this file except in compliance with the License.
@ -32,10 +32,10 @@
# Busybox and similar reduced shells will NOT work, because this script # Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features: # requires all of these POSIX shell features:
# * functions; # * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»; # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»; # * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit». # * various built-in commands including «command», «set», and «ulimit».
# #
# Important for patching: # Important for patching:
# #
@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop. # Darwin, MinGW, and NonStop.
# #
# (3) This script is generated from the Groovy template # (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project. # within the Gradle project.
# #
# You can find Gradle at https://github.com/gradle/gradle/. # You can find Gradle at https://github.com/gradle/gradle/.
@ -80,11 +80,14 @@ do
esac esac
done done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
APP_NAME="Gradle"
APP_BASE_NAME=${0##*/}
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum MAX_FD=maximum
@ -140,16 +143,12 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #( case $MAX_FD in #(
max*) max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) || MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit" warn "Could not query maximum file descriptor limit"
esac esac
case $MAX_FD in #( case $MAX_FD in #(
'' | soft) :;; #( '' | soft) :;; #(
*) *)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" || ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD" warn "Could not set maximum file descriptor limit to $MAX_FD"
esac esac
@ -194,10 +193,6 @@ if "$cygwin" || "$msys" ; then
done done
fi fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command; # Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in # shell script including quotes and variable substitutions, so put them in
@ -210,12 +205,6 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \ org.gradle.wrapper.GradleWrapperMain \
"$@" "$@"
# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi
# Use "xargs" to parse quoted args. # Use "xargs" to parse quoted args.
# #
# With -n1 it outputs one arg per line, with the quotes and backslashes removed. # With -n1 it outputs one arg per line, with the quotes and backslashes removed.

15
gradlew.bat vendored
View File

@ -14,7 +14,7 @@
@rem limitations under the License. @rem limitations under the License.
@rem @rem
@if "%DEBUG%"=="" @echo off @if "%DEBUG%" == "" @echo off
@rem ########################################################################## @rem ##########################################################################
@rem @rem
@rem Gradle startup script for Windows @rem Gradle startup script for Windows
@ -25,8 +25,7 @@
if "%OS%"=="Windows_NT" setlocal if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0 set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=. if "%DIRNAME%" == "" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0 set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@ -41,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1 %JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute if "%ERRORLEVEL%" == "0" goto execute
echo. echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@ -76,15 +75,13 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
:end :end
@rem End local scope for the variables with windows NT shell @rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd if "%ERRORLEVEL%"=="0" goto mainEnd
:fail :fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code! rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL% if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
if %EXIT_CODE% equ 0 set EXIT_CODE=1 exit /b 1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
:mainEnd :mainEnd
if "%OS%"=="Windows_NT" endlocal if "%OS%"=="Windows_NT" endlocal

View File

@ -1,113 +0,0 @@
// Использует Image Magick для автоматической перекраски текстур
const fs = require('fs')
const root_main = './src/main/resources/assets/overdrive_that_matters/textures/block/'
const child_process = require('child_process')
const args = process.argv.slice(2)
if (args.length != 1) {
console.error('Usage: <texture name>')
process.exit(2)
}
const colors = [
['white', [255, 255, 255]],
['orange', [245, 116, 16]],
['magenta', [186, 63, 175]],
['light_blue', [59, 180, 219]],
['yellow', [252, 199, 36]],
['lime', [111, 187, 24]],
['pink', [243, 139, 170]],
['gray', [62, 66, 70]],
['light_gray', [140, 140, 131]],
['cyan', [22, 134, 145]],
['purple', [116, 38, 169]],
['blue', [51, 53, 155]],
['brown', [114, 71, 40]],
['green', [84, 109, 28]],
['red', [156, 37, 34]],
['black', [31, 31, 35]],
]
process.stderr.setMaxListeners(40)
process.stdout.setMaxListeners(40)
async function size(path) {
const identify = child_process.spawn('magick', [
'identify',
path,
])
identify.stderr.pipe(process.stderr)
const chunks = []
identify.stdout.on('data', (a) => chunks.push(a))
await new Promise((resolve) => {
identify.on('close', () => resolve())
})
const chunk = chunks[0].toString('utf-8')
const size = chunk.match(/PNG ([0-9]+)x([0-9]+)/)
const width = parseInt(size[1])
const height = parseInt(size[2])
return [width, height]
}
(async function() {
const textureOverlay = args[0]
const textureColor = textureOverlay + '_mask'
if (!fs.existsSync(`${root_main}${textureOverlay}.png`)) {
process.stderr.write(`${textureOverlay}.png does not exist\n`)
process.exit(1)
}
if (!fs.existsSync(`${root_main}${textureColor}.png`)) {
process.stderr.write(`${textureColor}.png does not exist\n`)
process.exit(1)
}
try {
fs.mkdirSync(`${root_main}/${textureOverlay}`)
} catch(err) {
}
const [widthOverlay, heightOverlay] = await size(`${root_main}${textureOverlay}.png`)
const [width, height] = await size(`${root_main}${textureColor}.png`)
if (widthOverlay != width || heightOverlay != height) {
process.stderr.write(`${textureColor}.png has size of ${width}x${height}, overlay has size of ${widthOverlay}x${heightOverlay}!\n`)
process.exit(3)
}
for (const color of colors) {
const name = color[0]
const rgb = color[1]
const magick = child_process.spawn('magick', [
'convert',
`${root_main}${textureOverlay}.png`,
'(',
`${root_main}${textureColor}.png`,
'-size', `${width}x${height}`,
`xc:rgb(${rgb[0]}, ${rgb[1]}, ${rgb[2]})`,
'-channel', 'rgb',
'-compose', 'Multiply',
'-composite',
')',
'-compose', 'Over',
'-composite',
`${root_main}${textureOverlay}/${name}.png`])
magick.stdout.pipe(process.stdout)
magick.stderr.pipe(process.stderr)
}
})()

View File

@ -4,7 +4,6 @@ println("Running with Java ${System.getProperty("java.version")} on JVM: ${Syste
pluginManagement { pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
maven(url = "https://maven.neoforged.net/releases")
} }
} }
@ -15,12 +14,29 @@ plugins {
buildscript { buildscript {
repositories { repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below // These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven(url = "https://maven.neoforged.net/releases") { maven(url = "https://maven.minecraftforge.net") {
name = "Neoforge" name = "Minecraft Forge"
content { content {
includeGroup("net.neoforged.gradle") includeGroup("net.minecraftforge.gradle")
includeGroup("net.neoforged") includeGroup("net.minecraftforge")
}
}
maven(url = "https://repo.spongepowered.org/repository/maven-public/") {
name = "Spongepowered"
content {
includeGroup("org.spongepowered")
}
}
maven(url = "https://maven.parchmentmc.org") {
name = "Parchment mappings"
content {
includeGroup("org.parchmentmc")
includeGroup("org.parchmentmc.feather")
} }
} }
@ -31,10 +47,14 @@ buildscript {
val kotlin_version: String by settings val kotlin_version: String by settings
val forge_gradle_version: String by settings val forge_gradle_version: String by settings
val mixingradle_version: String by settings val mixingradle_version: String by settings
val koremods_modlauncher_version: String by settings
val koremods_script_version: String by settings
classpath(group = "net.neoforged.gradle", name = "userdev", version = forge_gradle_version) classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = forge_gradle_version)
classpath(group = "net.neoforged.gradle", name = "mixin", version = forge_gradle_version)
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}")
classpath("org.spongepowered:mixingradle:${mixingradle_version}")
classpath(group = "org.parchmentmc", name = "librarian", version = "1.+")
classpath(group = "org.gradle.toolchains", name = "foojay-resolver", version = "0.5.0") classpath(group = "org.gradle.toolchains", name = "foojay-resolver", version = "0.5.0")
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,14 +1,17 @@
package ru.dbotthepony.mc.otm.datagen package ru.dbotthepony.mc.otm.datagen
import net.minecraft.data.worldgen.BootstrapContext import net.minecraft.core.RegistrySetBuilder
import net.minecraft.core.registries.Registries
import net.minecraft.data.worldgen.BootstapContext
import net.minecraft.tags.DamageTypeTags import net.minecraft.tags.DamageTypeTags
import net.minecraft.world.damagesource.DamageEffects
import net.minecraft.world.damagesource.DamageScaling import net.minecraft.world.damagesource.DamageScaling
import net.minecraft.world.damagesource.DamageType import net.minecraft.world.damagesource.DamageType
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.datagen.tags.TagsProvider import ru.dbotthepony.mc.otm.datagen.tags.TagsProvider
import ru.dbotthepony.mc.otm.registry.MDamageTypes import ru.dbotthepony.mc.otm.registry.MDamageTypes
fun registerDamageTypes(context: BootstrapContext<DamageType>) { fun registerDamageTypes(context: BootstapContext<DamageType>) {
context.register(MDamageTypes.EXOPACK_PROBE, DamageType("otm_exopack_probe", DamageScaling.NEVER, 4.0f)) context.register(MDamageTypes.EXOPACK_PROBE, DamageType("otm_exopack_probe", DamageScaling.NEVER, 4.0f))
context.register(MDamageTypes.BECOME_ANDROID, DamageType("otm_become_android", DamageScaling.NEVER, 0f)) context.register(MDamageTypes.BECOME_ANDROID, DamageType("otm_become_android", DamageScaling.NEVER, 0f))
context.register(MDamageTypes.BECOME_HUMANE, DamageType("otm_become_humane", DamageScaling.NEVER, 0f)) context.register(MDamageTypes.BECOME_HUMANE, DamageType("otm_become_humane", DamageScaling.NEVER, 0f))
@ -20,8 +23,6 @@ fun registerDamageTypes(context: BootstrapContext<DamageType>) {
context.register(MDamageTypes.COSMIC_RAYS, DamageType("otm_cosmic_rays", DamageScaling.NEVER, 0f)) context.register(MDamageTypes.COSMIC_RAYS, DamageType("otm_cosmic_rays", DamageScaling.NEVER, 0f))
context.register(MDamageTypes.EXPLOSIVE_HAMMER, DamageType("otm_explosive_hammer", DamageScaling.NEVER, 0.1f)) context.register(MDamageTypes.EXPLOSIVE_HAMMER, DamageType("otm_explosive_hammer", DamageScaling.NEVER, 0.1f))
context.register(MDamageTypes.HAMMER_NAIL, DamageType("otm_hammer_nail", DamageScaling.NEVER, 0.1f)) context.register(MDamageTypes.HAMMER_NAIL, DamageType("otm_hammer_nail", DamageScaling.NEVER, 0.1f))
context.register(MDamageTypes.ANDROID_DISCHARGE, DamageType("otm_android_discharge", DamageScaling.NEVER, 4.0f))
context.register(MDamageTypes.NOT_NORMAL_PILL, DamageType("otm_not_normal_pill", DamageScaling.NEVER, 0f, DamageEffects.DROWNING))
} }
fun registerDamageTypeTags(provider: TagsProvider.Delegate<DamageType>) { fun registerDamageTypeTags(provider: TagsProvider.Delegate<DamageType>) {
@ -37,20 +38,14 @@ fun registerDamageTypeTags(provider: TagsProvider.Delegate<DamageType>) {
.add(MDamageTypes.EMP) .add(MDamageTypes.EMP)
.add(MDamageTypes.SHOCKWAVE) .add(MDamageTypes.SHOCKWAVE)
.add(MDamageTypes.COSMIC_RAYS) .add(MDamageTypes.COSMIC_RAYS)
.add(MDamageTypes.ANDROID_DISCHARGE)
.add(MDamageTypes.NOT_NORMAL_PILL)
ignoreMagic ignoreMagic
.add(MDamageTypes.EXOPACK_PROBE) .add(MDamageTypes.EXOPACK_PROBE)
.add(MDamageTypes.BECOME_ANDROID) .add(MDamageTypes.BECOME_ANDROID)
.add(MDamageTypes.BECOME_HUMANE) .add(MDamageTypes.BECOME_HUMANE)
.add(MDamageTypes.COSMIC_RAYS) .add(MDamageTypes.COSMIC_RAYS)
.add(MDamageTypes.ANDROID_DISCHARGE)
.add(MDamageTypes.NOT_NORMAL_PILL)
ignoreInvl ignoreInvl
.add(MDamageTypes.BECOME_HUMANE) .add(MDamageTypes.BECOME_HUMANE)
.add(MDamageTypes.BECOME_ANDROID) .add(MDamageTypes.BECOME_ANDROID)
.add(MDamageTypes.ANDROID_DISCHARGE)
.add(MDamageTypes.NOT_NORMAL_PILL)
} }

View File

@ -2,7 +2,6 @@ package ru.dbotthepony.mc.otm.datagen
import net.minecraft.core.RegistrySetBuilder import net.minecraft.core.RegistrySetBuilder
import net.minecraft.core.registries.Registries import net.minecraft.core.registries.Registries
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
@ -15,30 +14,29 @@ import net.minecraft.world.level.block.TrapDoorBlock
import net.minecraft.world.level.block.state.properties.DoorHingeSide import net.minecraft.world.level.block.state.properties.DoorHingeSide
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.minecraft.world.level.block.state.properties.Half import net.minecraft.world.level.block.state.properties.Half
import net.neoforged.bus.api.SubscribeEvent import net.minecraftforge.client.model.generators.ModelFile
import net.neoforged.fml.common.EventBusSubscriber import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
import net.neoforged.neoforge.client.model.generators.ModelFile import net.minecraftforge.common.data.ForgeAdvancementProvider
import net.neoforged.neoforge.common.data.AdvancementProvider import net.minecraftforge.eventbus.api.SubscribeEvent
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider import net.minecraftforge.fml.common.Mod
import net.neoforged.neoforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import net.neoforged.neoforge.registries.NeoForgeRegistries
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.player.android.AndroidResearchDataProvider import ru.dbotthepony.mc.otm.android.AndroidResearchDataProvider
import ru.dbotthepony.mc.otm.util.ResourceLocation import ru.dbotthepony.mc.otm.block.*
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.WriteOnce import ru.dbotthepony.mc.otm.core.util.WriteOnce
import ru.dbotthepony.mc.otm.datagen.blocks.BatteryBankProvider import ru.dbotthepony.mc.otm.datagen.blocks.BatteryBankProvider
import ru.dbotthepony.mc.otm.datagen.blocks.MatterBankProvider import ru.dbotthepony.mc.otm.datagen.blocks.MatterBankProvider
import ru.dbotthepony.mc.otm.datagen.blocks.MatteryBlockStateProvider import ru.dbotthepony.mc.otm.datagen.blocks.MatteryBlockStateProvider
import ru.dbotthepony.mc.otm.datagen.items.MatteryItemModelProvider import ru.dbotthepony.mc.otm.datagen.items.MatteryItemModelProvider
import ru.dbotthepony.mc.otm.datagen.lang.AddEnglishLanguage import ru.dbotthepony.mc.otm.datagen.lang.AddEnglishLanguage
import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider
import ru.dbotthepony.mc.otm.util.registryName import ru.dbotthepony.mc.otm.datagen.recipes.MatteryRecipeProvider
import ru.dbotthepony.mc.otm.util.GJRAND64RandomSource import ru.dbotthepony.mc.otm.registry.*
import ru.dbotthepony.mc.otm.data.FlywheelMaterialDataProvider import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.advancements.addAdvancements import ru.dbotthepony.mc.otm.datagen.advancements.addAdvancements
import ru.dbotthepony.mc.otm.datagen.advancements.addAndroidAdvancements import ru.dbotthepony.mc.otm.datagen.advancements.addAndroidAdvancements
import ru.dbotthepony.mc.otm.datagen.blocks.addBlockModels import ru.dbotthepony.mc.otm.datagen.advancements.addMachineAdvancements
import ru.dbotthepony.mc.otm.datagen.blocks.addBlockStates import ru.dbotthepony.mc.otm.datagen.blocks.addBlockStates
import ru.dbotthepony.mc.otm.datagen.blocks.addComplexBlockStates import ru.dbotthepony.mc.otm.datagen.blocks.addComplexBlockStates
import ru.dbotthepony.mc.otm.datagen.items.addItemModels import ru.dbotthepony.mc.otm.datagen.items.addItemModels
@ -46,33 +44,26 @@ import ru.dbotthepony.mc.otm.datagen.lang.AddRussianLanguage
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.datagen.loot.* import ru.dbotthepony.mc.otm.datagen.loot.*
import ru.dbotthepony.mc.otm.datagen.loot.LootModifiers import ru.dbotthepony.mc.otm.datagen.loot.LootModifiers
import ru.dbotthepony.mc.otm.datagen.recipes.* import ru.dbotthepony.mc.otm.datagen.models.addBlockModels
import ru.dbotthepony.mc.otm.datagen.recipes.addBlastingRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addCraftingTableRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addDecorativesRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addPlatePressRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addShapelessRecipes
import ru.dbotthepony.mc.otm.datagen.recipes.addOreSmeltingRecipes
import ru.dbotthepony.mc.otm.datagen.tags.TagsProvider import ru.dbotthepony.mc.otm.datagen.tags.TagsProvider
import ru.dbotthepony.mc.otm.datagen.tags.addConstructionTags
import ru.dbotthepony.mc.otm.datagen.tags.addDyeTags
import ru.dbotthepony.mc.otm.datagen.tags.addEquipmentTags
import ru.dbotthepony.mc.otm.datagen.tags.addMineableTags
import ru.dbotthepony.mc.otm.datagen.tags.addResourceTags
import ru.dbotthepony.mc.otm.datagen.tags.addStructureTags
import ru.dbotthepony.mc.otm.datagen.tags.addSuspiciousTags
import ru.dbotthepony.mc.otm.datagen.tags.addTags import ru.dbotthepony.mc.otm.datagen.tags.addTags
import ru.dbotthepony.mc.otm.matter.MatterDataProvider import ru.dbotthepony.mc.otm.matter.MatterDataProvider
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.DecorativeBlock
import kotlin.properties.Delegates import kotlin.properties.Delegates
internal fun modLocation(string: String) = ResourceLocation(DataGen.MOD_ID, string) internal fun modLocation(string: String) = ResourceLocation(DataGen.MOD_ID, string)
internal fun modLootTable(string: String) = ResourceKey.create(Registries.LOOT_TABLE, ResourceLocation(DataGen.MOD_ID, string))
@EventBusSubscriber(modid = DataGen.MOD_ID, bus = EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(modid = DataGen.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD)
object DataGen { object DataGen {
const val MOD_ID = OverdriveThatMatters.MOD_ID const val MOD_ID = OverdriveThatMatters.MOD_ID
// for things which need to be random (e.g. UUIDs),
// so builds continue to be reproducible
val random = GJRAND64RandomSource(822393940230754753L, -2728812999467395658L)
var blockModelProvider: MatteryBlockModelProvider by WriteOnce() var blockModelProvider: MatteryBlockModelProvider by WriteOnce()
private set private set
var itemModelProvider: MatteryItemModelProvider by WriteOnce() var itemModelProvider: MatteryItemModelProvider by WriteOnce()
@ -91,19 +82,12 @@ object DataGen {
private set private set
var matterData: MatterDataProvider by WriteOnce() var matterData: MatterDataProvider by WriteOnce()
private set private set
var flywheelData: FlywheelMaterialDataProvider by WriteOnce()
private set
fun decorativeCubeAll(vararg blocks: Block) { fun decorativeCubeAll(vararg blocks: Block) {
blockModelProvider.decorativeCubeAll(*blocks) blockModelProvider.decorativeCubeAll(*blocks)
blockStateProvider.simpleBlockM(*blocks) blockStateProvider.simpleBlockM(*blocks)
} }
fun decorativeCubeAllCutout(vararg blocks: Block) {
blockModelProvider.decorativeCubeAllCutout(*blocks)
blockStateProvider.simpleBlockM(*blocks)
}
fun decorativeCubeAll(subdir: String, vararg blocks: Block) { fun decorativeCubeAll(subdir: String, vararg blocks: Block) {
blockModelProvider.decorativeCubeAll(subdir, *blocks) blockModelProvider.decorativeCubeAll(subdir, *blocks)
blockStateProvider.simpleBlockM(*blocks) blockStateProvider.simpleBlockM(*blocks)
@ -129,11 +113,6 @@ object DataGen {
blockStateProvider.simpleBlockM(block) blockStateProvider.simpleBlockM(block)
} }
fun decorativePillar(block: Block, side: String, top: String) {
blockModelProvider.decorativeColumn(block, side, top)
blockStateProvider.simplePillar(block)
}
fun stairs(block: StairBlock, side: String, top: String) { fun stairs(block: StairBlock, side: String, top: String) {
blockStateProvider.exec { blockStateProvider.exec {
blockStateProvider.stairsBlock(block, modLocation(side), modLocation(top), modLocation(top)) blockStateProvider.stairsBlock(block, modLocation(side), modLocation(top), modLocation(top))
@ -440,7 +419,7 @@ object DataGen {
} }
} }
fun decoratives(list: ColoredDecorativeBlock<*>) { fun decoratives(list: ColoredDecorativeBlock) {
for (block in list.blocks.values) { for (block in list.blocks.values) {
decorativeCubeAll(block) decorativeCubeAll(block)
} }
@ -450,7 +429,7 @@ object DataGen {
} }
} }
fun decoratives(list: DecorativeBlock<*>) { fun decoratives(list: DecorativeBlock) {
for (block in list.allBlocks.values) { for (block in list.allBlocks.values) {
decorativeCubeAll(block) decorativeCubeAll(block)
} }
@ -460,7 +439,7 @@ object DataGen {
} }
} }
fun decoratives(subdir: String, list: ColoredDecorativeBlock<*>) { fun decoratives(subdir: String, list: ColoredDecorativeBlock) {
for (block in list.blocks.values) { for (block in list.blocks.values) {
decorativeCubeAll(subdir, block) decorativeCubeAll(subdir, block)
} }
@ -470,7 +449,7 @@ object DataGen {
} }
} }
fun decoratives(subdir: String, list: DecorativeBlock<*>) { fun decoratives(subdir: String, list: DecorativeBlock) {
for (block in list.allBlocks.values) { for (block in list.allBlocks.values) {
decorativeCubeAll(subdir, block) decorativeCubeAll(subdir, block)
} }
@ -480,7 +459,7 @@ object DataGen {
} }
} }
fun decoratives(subdir: String, suffix: String, list: ColoredDecorativeBlock<*>) { fun decoratives(subdir: String, suffix: String, list: ColoredDecorativeBlock) {
for (block in list.blocks.values) { for (block in list.blocks.values) {
decorativeCubeAll(subdir, suffix, block) decorativeCubeAll(subdir, suffix, block)
} }
@ -490,7 +469,7 @@ object DataGen {
} }
} }
fun decoratives(subdir: String, suffix: String, list: DecorativeBlock<*>) { fun decoratives(subdir: String, suffix: String, list: DecorativeBlock) {
for (block in list.allBlocks.values) { for (block in list.allBlocks.values) {
decorativeCubeAll(subdir, suffix, block) decorativeCubeAll(subdir, suffix, block)
} }
@ -501,14 +480,15 @@ object DataGen {
} }
@SubscribeEvent @SubscribeEvent
@JvmStatic
@Suppress("unused") @Suppress("unused")
fun onGatherData(event: GatherDataEvent) { fun onGatherData(event: GatherDataEvent) {
val blockModelProvider = MatteryBlockModelProvider(event) val blockModelProvider = MatteryBlockModelProvider(event)
val blockStateProvider = MatteryBlockStateProvider(event) val blockStateProvider = MatteryBlockStateProvider(event)
val itemModelProvider = MatteryItemModelProvider(event) val itemModelProvider = MatteryItemModelProvider(event)
val lootTableProvider = LootTables(event) val lootTableProvider = LootTables(event.generator)
val recipeProvider = MatteryRecipeProvider(event) val recipeProvider = MatteryRecipeProvider(event.generator)
val lootModifier = LootModifiers(event) val lootModifier = LootModifiers(event.generator)
val languageProvider = MatteryLanguageProvider(event.generator) val languageProvider = MatteryLanguageProvider(event.generator)
val matterData = MatterDataProvider(event) val matterData = MatterDataProvider(event)
val researchProvider = AndroidResearchDataProvider(event).also { it.exec { addResearchData(it, languageProvider) } } val researchProvider = AndroidResearchDataProvider(event).also { it.exec { addResearchData(it, languageProvider) } }
@ -522,46 +502,35 @@ object DataGen {
this.languageProvider = languageProvider this.languageProvider = languageProvider
this.researchProvider = researchProvider this.researchProvider = researchProvider
this.matterData = matterData this.matterData = matterData
this.flywheelData = FlywheelMaterialDataProvider(event)
val tagsProvider = TagsProvider(event) val tagsProvider = TagsProvider(event)
val advancementProvider = object : AdvancementProvider(event.generator.packOutput, event.lookupProvider, event.existingFileHelper, listOf( val advancementProvider = object : ForgeAdvancementProvider(event.generator.packOutput, event.lookupProvider, event.existingFileHelper, listOf(
AdvancementGenerator { registries, saver, existingFileHelper -> AdvancementGenerator { registries, saver, existingFileHelper ->
addAdvancements(saver, languageProvider) addAdvancements(saver, existingFileHelper, languageProvider)
addAndroidAdvancements(saver, languageProvider) addAndroidAdvancements(saver, existingFileHelper, languageProvider)
addMachineAdvancements(saver, existingFileHelper, languageProvider)
} }
)) {} )) {}
addTags(tagsProvider) addTags(tagsProvider)
addSuspiciousTags(tagsProvider)
addConstructionTags(tagsProvider)
addResourceTags(tagsProvider)
addEquipmentTags(tagsProvider)
addMineableTags(tagsProvider)
addDyeTags(tagsProvider)
addStructureTags(tagsProvider)
event.generator.addProvider(event.includeClient(), blockModelProvider) event.generator.addProvider(event.includeClient(), blockModelProvider)
event.generator.addProvider(event.includeServer(), blockStateProvider) event.generator.addProvider(event.includeServer(), blockStateProvider)
event.generator.addProvider(event.includeClient(), itemModelProvider) event.generator.addProvider(event.includeClient(), itemModelProvider)
event.generator.addProvider(event.includeServer(), recipeProvider) event.generator.addProvider(event.includeServer(), recipeProvider)
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), MatterBankProvider(event, it)) } event.generator.addProvider(event.includeClient(), MatterBankProvider(event))
event.generator.addProvider(event.includeClient(), MatterBankProvider(event, null)) event.generator.addProvider(event.includeClient(), BatteryBankProvider(event))
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, it)) }
event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, null))
event.generator.addProvider(event.includeServer(), lootTableProvider) event.generator.addProvider(event.includeServer(), lootTableProvider)
event.generator.addProvider(event.includeServer(), lootModifier) event.generator.addProvider(event.includeServer(), lootModifier)
event.generator.addProvider(event.includeServer(), SoundDataProvider(event)) event.generator.addProvider(event.includeServer(), SoundDataProvider(event))
event.generator.addProvider(event.includeServer(), researchProvider) event.generator.addProvider(event.includeServer(), researchProvider)
event.generator.addProvider(event.includeServer(), advancementProvider) event.generator.addProvider(event.includeServer(), advancementProvider)
event.generator.addProvider(event.includeServer(), matterData) event.generator.addProvider(event.includeServer(), matterData)
event.generator.addProvider(event.includeServer(), flywheelData)
val registrySetBuilder = RegistrySetBuilder() val registrySetBuilder = RegistrySetBuilder()
.add(Registries.DAMAGE_TYPE, ::registerDamageTypes) .add(Registries.DAMAGE_TYPE, ::registerDamageTypes)
.add(Registries.CONFIGURED_FEATURE, ::registerConfiguredFeatures) .add(Registries.CONFIGURED_FEATURE, ::registerConfiguredFeatures)
.add(Registries.PLACED_FEATURE, ::registerPlacedFeatures) .add(Registries.PLACED_FEATURE, ::registerPlacedFeatures)
.add(NeoForgeRegistries.Keys.BIOME_MODIFIERS, ::registerBiomeModifiers)
event.generator.addProvider(event.includeServer(), DatapackBuiltinEntriesProvider(event.generator.packOutput, event.lookupProvider, registrySetBuilder, setOf(MOD_ID))) event.generator.addProvider(event.includeServer(), DatapackBuiltinEntriesProvider(event.generator.packOutput, event.lookupProvider, registrySetBuilder, setOf(MOD_ID)))
@ -575,7 +544,7 @@ object DataGen {
trapdoor(MBlocks.TRITANIUM_TRAPDOOR[null]!!, modLocation("block/decorative/tritanium_trapdoor")) trapdoor(MBlocks.TRITANIUM_TRAPDOOR[null]!!, modLocation("block/decorative/tritanium_trapdoor"))
for (color in DyeColor.entries) for (color in DyeColor.values())
trapdoor(MBlocks.TRITANIUM_TRAPDOOR[color]!!, modLocation("block/decorative/tritanium_trapdoor_${color.name.lowercase()}")) trapdoor(MBlocks.TRITANIUM_TRAPDOOR[color]!!, modLocation("block/decorative/tritanium_trapdoor_${color.name.lowercase()}"))
addBlockModels(blockModelProvider) addBlockModels(blockModelProvider)
@ -586,31 +555,17 @@ object DataGen {
addItemModels(itemModelProvider) addItemModels(itemModelProvider)
blockStateProvider.exec { addComplexBlockStates(blockStateProvider) } blockStateProvider.exec { addComplexBlockStates(blockStateProvider) }
addLootTables(lootTableProvider) addLootTables(lootTableProvider)
addMachineLoot(lootTableProvider)
addDecorativeLoot(lootTableProvider)
addAdvancementLoot(lootTableProvider)
addVaultLoot(lootTableProvider)
addEntityLoot(lootTableProvider)
addChestLootTables(lootTableProvider) addChestLootTables(lootTableProvider)
recipeProvider.exec { _, consumer -> recipeProvider.exec { _, consumer ->
addToolsRecipes(consumer)
addComponentRecipes(consumer)
addStorageItemRecipes(consumer)
addCraftingTableRecipes(consumer) addCraftingTableRecipes(consumer)
addMultiblockRecipes(consumer)
addBlastingRecipes(consumer) addBlastingRecipes(consumer)
addDecorativesRecipes(recipeProvider, consumer) addDecorativesRecipes(recipeProvider, consumer)
addMachineUpgradeRecipes(consumer)
addShapelessRecipes(consumer) addShapelessRecipes(consumer)
addOreSmeltingRecipes(consumer) addOreSmeltingRecipes(consumer)
addPainterRecipes(consumer)
addMatterEntanglerRecipes(consumer)
addSuspiciousRecipes(consumer)
} }
addPlatePressRecipes(recipeProvider) addPlatePressRecipes(recipeProvider)
addMicrowaveRecipes(recipeProvider)
lootModifier.lambda { lootModifier.lambda {
addLootModifiers(it) addLootModifiers(it)
@ -619,7 +574,6 @@ object DataGen {
languageProvider.registerProviders() languageProvider.registerProviders()
addMatterData(matterData) addMatterData(matterData)
addFlywheelMaterials(flywheelData)
tagsProvider.register() tagsProvider.register()
} }

View File

@ -1,24 +1,23 @@
package ru.dbotthepony.mc.otm.datagen package ru.dbotthepony.mc.otm.datagen
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.AnvilBlock import net.minecraft.world.level.block.AnvilBlock
import net.minecraft.world.level.block.SlabBlock import net.minecraft.world.level.block.SlabBlock
import net.minecraft.world.level.block.StairBlock import net.minecraft.world.level.block.StairBlock
import net.minecraft.world.level.block.WallBlock import net.minecraft.world.level.block.WallBlock
import net.minecraft.world.level.block.state.properties.BlockStateProperties import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.neoforged.neoforge.client.model.generators.BlockModelBuilder import net.minecraftforge.client.model.generators.BlockModelBuilder
import net.neoforged.neoforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
import net.neoforged.neoforge.client.model.generators.ModelFile import net.minecraftforge.client.model.generators.ModelFile
import ru.dbotthepony.mc.otm.util.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.xRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.blocks.MatteryBlockStateProvider import ru.dbotthepony.mc.otm.datagen.blocks.MatteryBlockStateProvider
import ru.dbotthepony.mc.otm.datagen.items.MatteryItemModelProvider import ru.dbotthepony.mc.otm.datagen.items.MatteryItemModelProvider
import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider
import ru.dbotthepony.mc.otm.registry.game.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
import kotlin.properties.Delegates import kotlin.properties.Delegates
@ -35,29 +34,10 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
} }
DataGen.decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK) DataGen.decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK)
DataGen.decorativeCubeAllCutout(MBlocks.METAL_MESH)
DataGen.decoratives(MRegistry.TRITANIUM_BLOCK) DataGen.decoratives(MRegistry.TRITANIUM_BLOCK)
for (color in DyeColor.entries) { for (anvil in MBlocks.TRITANIUM_ANVIL) {
blockModelProvider.exec {
blockModelProvider.withExistingParent("block/tritanium_anvil0_${color.name.lowercase()}", "${DataGen.MOD_ID}:block/tritanium_anvil0")
.texture("3", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
.texture("particle", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
}
for (i in 1 until MBlocks.TRITANIUM_ANVIL_VARIANTS) {
blockModelProvider.exec {
blockModelProvider.withExistingParent("block/tritanium_anvil${i}_${color.name.lowercase()}", "${DataGen.MOD_ID}:block/tritanium_anvil$i")
.texture("2", modLocation("block/tritanium_anvil_top/${color.name.lowercase()}"))
.texture("3", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
.texture("particle", modLocation("block/tritanium_anvil/${color.name.lowercase()}"))
}
}
}
for (anvils in MBlocks.TRITANIUM_ANVIL.values) {
for (anvil in anvils) {
blockStateProvider.exec { blockStateProvider.exec {
blockStateProvider.getVariantBuilder(anvil).forAllStates { blockStateProvider.getVariantBuilder(anvil).forAllStates {
ConfiguredModel.builder() ConfiguredModel.builder()
@ -67,10 +47,9 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
} }
} }
} }
}
for ((color, block) in MRegistry.TRITANIUM_STAIRS.allBlocks) { for ((color, block) in MRegistry.TRITANIUM_STAIRS.allBlocks) {
DataGen.decorativeStairs(block, MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path, MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path) DataGen.decorativeStairs(block as StairBlock, MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path, MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path)
} }
for ((color, block) in MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks) { for ((color, block) in MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks) {
@ -98,7 +77,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
for ((color, block) in MRegistry.TRITANIUM_SLAB.allBlocks) { for ((color, block) in MRegistry.TRITANIUM_SLAB.allBlocks) {
blockStateProvider.exec { blockStateProvider.exec {
blockStateProvider.slabBlock( blockStateProvider.slabBlock(
block, block as SlabBlock,
MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!, MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!,
modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/${MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path}") modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/${MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path}")
) )
@ -108,7 +87,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
for ((color, block) in MRegistry.FLOOR_TILES_SLAB.blocks) { for ((color, block) in MRegistry.FLOOR_TILES_SLAB.blocks) {
blockStateProvider.exec { blockStateProvider.exec {
blockStateProvider.slabBlock( blockStateProvider.slabBlock(
block, block as SlabBlock,
MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!, MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!,
modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/${MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!.path}") modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/${MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!.path}")
) )
@ -117,7 +96,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
for ((color, block) in MRegistry.FLOOR_TILES_STAIRS.blocks) { for ((color, block) in MRegistry.FLOOR_TILES_STAIRS.blocks) {
DataGen.decorativeStairs( DataGen.decorativeStairs(
block, block as StairBlock,
MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!.path, MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!.path,
MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!.path MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!.path
) )
@ -125,7 +104,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
for ((color, block) in MRegistry.TRITANIUM_WALL.allBlocks) { for ((color, block) in MRegistry.TRITANIUM_WALL.allBlocks) {
DataGen.decorativeWall( DataGen.decorativeWall(
block, block as WallBlock,
sideTexture = MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path, sideTexture = MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path,
topTexture = MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path topTexture = MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!.path
) )
@ -161,19 +140,6 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
blockModelProvider.decorativeGlassAll(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) blockModelProvider.decorativeGlassAll(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
blockStateProvider.simpleBlockM(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) blockStateProvider.simpleBlockM(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
blockModelProvider.colored("computer_terminal", mapOf(
"0" to "decorative/computer_base",
"1" to "decorative/computer_screen",
"particle" to "decorative/computer_base",
))
blockStateProvider.block(MRegistry.COMPUTER_TERMINAL.allBlocks.values)
blockModelProvider.colored("star_chair", mapOf(
"1" to "decorative/star_chair",
"2" to "powered_smoker_base",
))
blockStateProvider.block(MRegistry.STAR_CHAIR.allBlocks.values)
blockStateProvider.simpleBlockM(MBlocks.FLUID_TANK) blockStateProvider.simpleBlockM(MBlocks.FLUID_TANK)
for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) { for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) {
@ -225,8 +191,8 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
} }
} }
DataGen.decorativePillar(MBlocks.METAL_BEAM, "metal_beam_side", "metal_beam_top") DataGen.decorativeCubeAll(MBlocks.DANGER_STRIPE_BLOCK)
blockModelProvider.decorativeCubeAll(MBlocks.METAL_BEAM_CENTER, "metal_beam_top") DataGen.decorativeColumn(MBlocks.METAL_BEAM, "metal_beam_side", "metal_beam_top")
var labLampOn: BlockModelBuilder? = null var labLampOn: BlockModelBuilder? = null
var labLampOff: BlockModelBuilder? = null var labLampOff: BlockModelBuilder? = null
@ -257,26 +223,23 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
itemModelProvider.block(MItems.LABORATORY_LAMP) itemModelProvider.block(MItems.LABORATORY_LAMP)
itemModelProvider.block(MItems.LABORATORY_LAMP_INVERTED, MItems.LABORATORY_LAMP.registryName!!.path + "_unlit") itemModelProvider.block(MItems.LABORATORY_LAMP_INVERTED, MItems.LABORATORY_LAMP.registryName!!.path + "_unlit")
itemModelProvider.block(MItems.DANGER_STRIPE_BLOCK, MItems.DANGER_STRIPE_BLOCK.registryName!!.path + "_0") itemModelProvider.block(MItems.DANGER_STRIPE_BLOCK)
itemModelProvider.block(MItems.METAL_BEAM) itemModelProvider.block(MItems.METAL_BEAM)
blockStateProvider.block(MBlocks.METAL_BEAM_CENTER)
itemModelProvider.block(MItems.METAL_BEAM_CENTER)
blockStateProvider.exec { blockStateProvider.exec {
blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP).forAllStates { blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP).forAllStates {
return@forAllStates ConfiguredModel.builder() return@forAllStates ConfiguredModel.builder()
.modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!) .modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!)
.rotationX(it[BlockRotationFreedom.DIRECTIONAL.property].front.xRotationBlockstateNorth()) .rotationX(it[BlockRotationFreedom.TWO.property].front.xRotationBlockstateNorth())
.rotationY(it[BlockRotationFreedom.DIRECTIONAL.property].front.yRotationBlockstateNorth()) .rotationY(it[BlockRotationFreedom.TWO.property].front.yRotationBlockstateNorth())
.build() .build()
} }
blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP_INVERTED).forAllStates { blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP_INVERTED).forAllStates {
return@forAllStates ConfiguredModel.builder() return@forAllStates ConfiguredModel.builder()
.modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!) .modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!)
.rotationX(it[BlockRotationFreedom.DIRECTIONAL.property].front.xRotationBlockstateNorth()) .rotationX(it[BlockRotationFreedom.TWO.property].front.xRotationBlockstateNorth())
.rotationY(it[BlockRotationFreedom.DIRECTIONAL.property].front.yRotationBlockstateNorth()) .rotationY(it[BlockRotationFreedom.TWO.property].front.yRotationBlockstateNorth())
.build() .build()
} }
} }
@ -284,41 +247,27 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
blockModelProvider.exec { blockModelProvider.exec {
for (crate in MRegistry.CARGO_CRATES.blocks.values) { for (crate in MRegistry.CARGO_CRATES.blocks.values) {
it.withExistingParent("${crate.registryName!!.path}_closed", modLocation("${MNames.CARGO_CRATE}_closed")) it.withExistingParent("${crate.registryName!!.path}_closed", modLocation("${MNames.CARGO_CRATE}_closed"))
.texture("body", "block/cargo_crates/${crate.registryName!!.path}") .texture("texture", "block/cargo_crates/${crate.registryName!!.path}")
.texture("particle", "block/cargo_crates/${crate.registryName!!.path}") .texture("particle", "block/cargo_crates/${crate.registryName!!.path}")
it.withExistingParent("${crate.registryName!!.path}_open", modLocation("${MNames.CARGO_CRATE}_open")) it.withExistingParent("${crate.registryName!!.path}_open", modLocation("${MNames.CARGO_CRATE}_open"))
.texture("body", "block/cargo_crates/${crate.registryName!!.path}") .texture("texture", "block/cargo_crates/${crate.registryName!!.path}")
.texture("particle", "block/cargo_crates/${crate.registryName!!.path}") .texture("particle", "block/cargo_crates/${crate.registryName!!.path}")
} }
} }
MBlocks.TRITANIUM_STRIPED_BLOCK.entries.forEach { (c, it) -> DataGen.decorativeColumn(MBlocks.TRITANIUM_STRIPED_BLOCK, "tritanium_striped_block", "tritanium_block")
DataGen.decorativeColumn(it, "stripe/tritanium_striped_block_${c.name.lowercase()}", "tritanium_block") DataGen.decorativeStairs(MBlocks.TRITANIUM_STRIPED_STAIRS as StairBlock, "tritanium_striped_block", "tritanium_block")
} DataGen.decorativeWall(MBlocks.TRITANIUM_STRIPED_WALL as WallBlock, "tritanium_striped_block", "tritanium_block")
DataGen.decorativeSlab(MBlocks.TRITANIUM_STRIPED_SLAB as SlabBlock, MBlocks.TRITANIUM_STRIPED_BLOCK.registryName!!, "tritanium_striped_block", "tritanium_block")
MBlocks.TRITANIUM_STRIPED_STAIRS.entries.forEach { (c, it) -> itemModelProvider.block(MItems.TRITANIUM_STRIPED_STAIRS)
DataGen.decorativeStairs(it, "stripe/tritanium_striped_block_${c.name.lowercase()}", "tritanium_block") itemModelProvider.block(MItems.TRITANIUM_STRIPED_SLAB)
}
MBlocks.TRITANIUM_STRIPED_WALL.entries.forEach { (c, it) ->
DataGen.decorativeWall(it, "stripe/tritanium_striped_block_${c.name.lowercase()}", "tritanium_block")
}
MBlocks.TRITANIUM_STRIPED_SLAB.entries.forEach { (c, it) ->
DataGen.decorativeSlab(it, MBlocks.TRITANIUM_STRIPED_BLOCK[c]!!.registryName!!, "stripe/tritanium_striped_block_${c.name.lowercase()}", "tritanium_block")
}
itemModelProvider.blocks(MItems.TRITANIUM_STRIPED_STAIRS.values)
itemModelProvider.blocks(MItems.TRITANIUM_STRIPED_SLAB.values)
itemModelProvider.exec { itemModelProvider.exec {
MBlocks.TRITANIUM_STRIPED_WALL.entries.forEach { (c, it) -> itemModelProvider.withExistingParent(MItems.TRITANIUM_STRIPED_WALL.registryName!!.path, modLocation("block/wall_inventory"))
itemModelProvider.withExistingParent(it.registryName!!.path, modLocation("block/wall_inventory")) .texture("wall_side", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_striped_block"))
.texture("wall_side", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/stripe/tritanium_striped_block_${c.name.lowercase()}"))
.texture("wall", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_block")) .texture("wall", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_block"))
} }
}
for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks) { for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks) {
val name = MRegistry.INDUSTRIAL_GLASS.allBlocks[color]!!.registryName!!.path val name = MRegistry.INDUSTRIAL_GLASS.allBlocks[color]!!.registryName!!.path
@ -328,7 +277,6 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
} }
DataGen.bars(MBlocks.TRITANIUM_BARS, modLocation("block/decorative/tritanium_bars")) DataGen.bars(MBlocks.TRITANIUM_BARS, modLocation("block/decorative/tritanium_bars"))
DataGen.bars(MBlocks.METAL_RAILING, modLocation("block/decorative/metal_railing"))
blockStateProvider.block(MBlocks.ENGINE) blockStateProvider.block(MBlocks.ENGINE)
itemModelProvider.block(MItems.ENGINE) itemModelProvider.block(MItems.ENGINE)

View File

@ -1,15 +0,0 @@
package ru.dbotthepony.mc.otm.datagen
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.util.math.Decimal
import ru.dbotthepony.mc.otm.data.FlywheelMaterialDataProvider
import ru.dbotthepony.mc.otm.registry.MBlockTags
fun addFlywheelMaterials(provider: FlywheelMaterialDataProvider) {
provider.add(Tags.Blocks.STORAGE_BLOCKS_DIAMOND, Decimal(25_000_000))
provider.add(Tags.Blocks.STORAGE_BLOCKS_COPPER, Decimal(60_000_000))
provider.add(Tags.Blocks.STORAGE_BLOCKS_IRON, Decimal(50_000_000))
provider.add(Tags.Blocks.STORAGE_BLOCKS_GOLD, Decimal(300_000_000), momentumLossSpeed = Decimal("0.75"))
provider.add(Tags.Blocks.STORAGE_BLOCKS_NETHERITE, Decimal(1_250_000_000), momentumLossSpeed = Decimal.ONE_HALF)
provider.add(MBlockTags.TRITANIUM_BLOCKS, Decimal(225_000_000))
}

View File

@ -3,11 +3,13 @@ package ru.dbotthepony.mc.otm.datagen
import net.minecraft.tags.ItemTags import net.minecraft.tags.ItemTags
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.neoforged.neoforge.common.Tags import net.minecraftforge.common.Tags
import ru.dbotthepony.mc.otm.util.math.Decimal import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.matter.ComputeAction
import ru.dbotthepony.mc.otm.matter.MatterDataProvider import ru.dbotthepony.mc.otm.matter.MatterDataProvider
import ru.dbotthepony.mc.otm.matter.MatterFunction
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
// general rule - anything plant or organic is much more complex than mineral // general rule - anything plant or organic is much more complex than mineral
// and anything mineral has much bigger matter value than complexity (just throw a lot of same molecules) // and anything mineral has much bigger matter value than complexity (just throw a lot of same molecules)
@ -16,25 +18,8 @@ fun addMatterData(provider: MatterDataProvider) {
provider.inherit(Items.CHIPPED_ANVIL, Items.ANVIL, 0.75) provider.inherit(Items.CHIPPED_ANVIL, Items.ANVIL, 0.75)
provider.inherit(Items.DAMAGED_ANVIL, Items.ANVIL, 0.5) provider.inherit(Items.DAMAGED_ANVIL, Items.ANVIL, 0.5)
for (anvils in MItems.TRITANIUM_ANVIL.values) { for (i in 1 until MItems.TRITANIUM_ANVIL.size) {
for (i in 1 until anvils.size) { provider.inherit(MItems.TRITANIUM_ANVIL[i], MItems.TRITANIUM_ANVIL[i - 1], 0.85)
provider.inherit(anvils[i], anvils[i - 1], 0.85)
}
}
provider.inherit(Items.WATER_BUCKET, Items.BUCKET) {
plus(Decimal(1), 20.0)
}
provider.inherit(Items.LAVA_BUCKET, Items.MAGMA_BLOCK) {
plus(Decimal(0), 666.0)
plus(Items.BUCKET)
}
provider.inherit(Items.POWDER_SNOW_BUCKET, Items.SNOW_BLOCK) {
multiply(Decimal(0.75), 1.0)
plus(Decimal(0), 200.0)
plus(Items.BUCKET)
} }
provider.inherit(Items.MILK_BUCKET, Items.BUCKET) { provider.inherit(Items.MILK_BUCKET, Items.BUCKET) {
@ -90,23 +75,6 @@ fun addMatterData(provider: MatterDataProvider) {
provider.inherit(Items.RED_CONCRETE, Items.RED_CONCRETE_POWDER) provider.inherit(Items.RED_CONCRETE, Items.RED_CONCRETE_POWDER)
provider.inherit(Items.BLACK_CONCRETE, Items.BLACK_CONCRETE_POWDER) provider.inherit(Items.BLACK_CONCRETE, Items.BLACK_CONCRETE_POWDER)
provider.inherit(Items.WHITE_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.ORANGE_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.MAGENTA_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.LIGHT_BLUE_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.YELLOW_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.LIME_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.PINK_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.GRAY_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.LIGHT_GRAY_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.CYAN_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.PURPLE_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.BLUE_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.BROWN_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.GREEN_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.RED_WOOL, Items.STRING, Decimal(4))
provider.inherit(Items.BLACK_WOOL, Items.STRING, Decimal(4))
with(provider) { with(provider) {
blacklist(Tags.Items.RAW_MATERIALS) blacklist(Tags.Items.RAW_MATERIALS)
blacklist(Tags.Items.RAW_MATERIALS_COPPER) blacklist(Tags.Items.RAW_MATERIALS_COPPER)
@ -153,12 +121,12 @@ fun addMatterData(provider: MatterDataProvider) {
relative(Items.PACKED_ICE, 1.5, 1) relative(Items.PACKED_ICE, 1.5, 1)
// rocks // rocks
scope(Tags.Items.STONES, 1.1, 1.1) { scope(Tags.Items.STONE, 1.1, 1.1) {
equal(Tags.Items.COBBLESTONES) equal(Tags.Items.COBBLESTONE)
equal(Tags.Items.GRAVELS) equal(Tags.Items.GRAVEL)
equal(Items.FLINT) equal(Items.FLINT)
equal(Tags.Items.SANDS) equal(Tags.Items.SAND)
equal(Tags.Items.NETHERRACKS) equal(Tags.Items.NETHERRACK)
scope(1.4, 1.5) { scope(1.4, 1.5) {
equal(Items.BASALT) equal(Items.BASALT)
@ -186,7 +154,7 @@ fun addMatterData(provider: MatterDataProvider) {
relative(Items.REINFORCED_DEEPSLATE, 3, 1.4) relative(Items.REINFORCED_DEEPSLATE, 3, 1.4)
} }
relative(Tags.Items.OBSIDIANS, 10, 1.5) relative(Tags.Items.OBSIDIAN, 10, 1.5)
relative(Items.CRYING_OBSIDIAN, 14, 3) relative(Items.CRYING_OBSIDIAN, 14, 3)
} }
@ -222,7 +190,7 @@ fun addMatterData(provider: MatterDataProvider) {
// drops from mobs // drops from mobs
scope(Items.ROTTEN_FLESH, 8, 1.5) { scope(Items.ROTTEN_FLESH, 8, 1.5) {
equal(Items.INK_SAC) equal(Items.INK_SAC)
equal(Tags.Items.LEATHERS) equal(Tags.Items.LEATHER)
equal(Items.LEATHER) equal(Items.LEATHER)
relative(Items.RABBIT_FOOT, 1.1, 1.5) relative(Items.RABBIT_FOOT, 1.1, 1.5)
@ -232,15 +200,14 @@ fun addMatterData(provider: MatterDataProvider) {
relative(Tags.Items.BONES, 1, 1.25) relative(Tags.Items.BONES, 1, 1.25)
relative(Tags.Items.STRINGS, 0.8, 0.75) relative(Tags.Items.STRING, 0.8, 0.75)
relative(Items.COBWEB, 0.8, 0.75) relative(Items.COBWEB, 0.8, 0.75)
relative(Items.SPIDER_EYE, 0.8, 1.8) relative(Items.SPIDER_EYE, 0.8, 1.8)
relative(Tags.Items.SLIME_BALLS, 1, 1.4) relative(Tags.Items.SLIMEBALLS, 1, 1.4)
relative(Tags.Items.GUNPOWDERS, 0.85, 1.15) relative(Tags.Items.GUNPOWDER, 0.85, 1.15)
relative(Items.TURTLE_SCUTE, 1, 1.5) relative(Items.SCUTE, 1, 1.5)
relative(Items.ARMADILLO_SCUTE, 1, 1.8)
relative(Items.FEATHER, 0.7, 1.25) relative(Items.FEATHER, 0.7, 1.25)
relative(Items.EGG, 1.25, 4) relative(Items.EGG, 1.25, 4)
@ -263,7 +230,7 @@ fun addMatterData(provider: MatterDataProvider) {
relative(Items.SCULK_VEIN, 2.5, 24) relative(Items.SCULK_VEIN, 2.5, 24)
// planty // planty
scope(Items.SHORT_GRASS, 1.5, 2.5) { scope(Items.GRASS, 1.5, 2.5) {
equal(Items.SUNFLOWER) equal(Items.SUNFLOWER)
equal(Items.LILAC) equal(Items.LILAC)
equal(Items.ROSE_BUSH) equal(Items.ROSE_BUSH)
@ -437,6 +404,4 @@ fun addMatterData(provider: MatterDataProvider) {
} }
} }
} }
provider.inherit(MItems.IMPERFECT_BREAD, Items.BREAD, 1.5)
} }

View File

@ -0,0 +1,58 @@
package ru.dbotthepony.mc.otm.datagen
import net.minecraft.core.RegistrySetBuilder
import net.minecraft.core.registries.Registries
import net.minecraft.data.worldgen.BootstapContext
import net.minecraft.resources.ResourceKey
import net.minecraft.tags.BlockTags
import net.minecraft.world.level.levelgen.VerticalAnchor
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature
import net.minecraft.world.level.levelgen.feature.Feature
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration
import net.minecraft.world.level.levelgen.placement.CountPlacement
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement
import net.minecraft.world.level.levelgen.placement.InSquarePlacement
import net.minecraft.world.level.levelgen.placement.PlacedFeature
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.registry.MBlocks
private val oreKey by lazy { ResourceKey.create(Registries.CONFIGURED_FEATURE, modLocation("tritanium_ore")) }
fun registerConfiguredFeatures(context: BootstapContext<ConfiguredFeature<*, *>>) {
val stone = TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES)
val deepslate = TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES)
val target = listOf(
OreConfiguration.target(stone, MBlocks.TRITANIUM_ORE.defaultBlockState()),
OreConfiguration.target(deepslate, MBlocks.DEEPSLATE_TRITANIUM_ORE.defaultBlockState()),
)
context.register(oreKey, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 9)))
}
fun registerPlacedFeatures(context: BootstapContext<PlacedFeature>) {
fun location(name: String) = ResourceKey.create(Registries.PLACED_FEATURE, modLocation(name))
val configured = context.lookup(Registries.CONFIGURED_FEATURE)
val ore = configured.getOrThrow(oreKey)
context.register(location("normal_tritanium"), PlacedFeature(
ore,
listOf(
CountPlacement.of(8),
InSquarePlacement.spread(),
HeightRangePlacement.triangle(VerticalAnchor.absolute(0), VerticalAnchor.absolute(50))
)
))
context.register(location("deep_tritanium"), PlacedFeature(
ore,
listOf(
CountPlacement.of(10),
InSquarePlacement.spread(),
HeightRangePlacement.uniform(VerticalAnchor.aboveBottom(8), VerticalAnchor.absolute(0))
)
))
}

View File

@ -2,18 +2,22 @@ package ru.dbotthepony.mc.otm.datagen
import net.minecraft.tags.ItemTags import net.minecraft.tags.ItemTags
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.neoforged.neoforge.common.Tags import net.minecraftforge.common.Tags
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.player.android.AndroidResearchDescriptions import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.player.android.AndroidResearchResults import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature
import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.feature.FallDampenersFeature
import ru.dbotthepony.mc.otm.android.feature.ItemMagnetFeature
import ru.dbotthepony.mc.otm.android.feature.JumpBoostFeature
import ru.dbotthepony.mc.otm.android.feature.NanobotsArmorFeature
import ru.dbotthepony.mc.otm.android.feature.ShockwaveFeature
import ru.dbotthepony.mc.otm.client.render.ResearchIcons import ru.dbotthepony.mc.otm.client.render.ResearchIcons
import ru.dbotthepony.mc.otm.util.TextComponent import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.util.TranslatableComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.registry.AndroidFeatures
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MNames
import java.util.LinkedList import java.util.LinkedList
import java.util.function.Consumer import java.util.function.Consumer
@ -43,45 +47,6 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
serializer.accept(IMPROVED_LIMBS) serializer.accept(IMPROVED_LIMBS)
val SWIM_BOOSTERS = AndroidResearchType.Builder(modLocation(MNames.SWIM_BOOSTERS))
.withExperience(26)
.withDescription(AndroidResearchDescriptions.SWIM_BOOSTERS.Instance(0))
.addPrerequisite(IMPROVED_LIMBS)
.addPrerequisite(AIR_BAGS)
.addFeatureResult(AndroidFeatures.SWIM_BOOSTERS)
.withIcon(ResearchIcons.ICON_LIMB_OVERCLOCKING)
.addItem(MItemTags.TRITANIUM_PLATES, 2)
.addItem(MItemTags.COPPER_WIRES, 2)
.addItem(MItems.ELECTROMOTOR, 2)
.build()
serializer.accept(SWIM_BOOSTERS)
val SWIM_BOOSTERS_2 = AndroidResearchType.Builder(modLocation(MNames.SWIM_BOOSTERS + "_2"))
.withExperience(30)
.withDescription(AndroidResearchDescriptions.SWIM_BOOSTERS.Instance(1))
.addPrerequisite(SWIM_BOOSTERS)
.addFeatureLevel(AndroidFeatures.SWIM_BOOSTERS)
.withIcon(ResearchIcons.ICON_LIMB_OVERCLOCKING)
.addItem(MItemTags.GOLD_WIRES, 8)
.addItem(MItems.ELECTROMOTOR, 2)
.build()
serializer.accept(SWIM_BOOSTERS_2)
val SWIM_BOOSTERS_3 = AndroidResearchType.Builder(modLocation(MNames.SWIM_BOOSTERS + "_3"))
.withExperience(30)
.withDescription(AndroidResearchDescriptions.SWIM_BOOSTERS.Instance(2))
.addPrerequisite(SWIM_BOOSTERS_2)
.addFeatureLevel(AndroidFeatures.SWIM_BOOSTERS)
.withIcon(ResearchIcons.ICON_LIMB_OVERCLOCKING)
.addItem(MItemTags.CARBON_PLATES, 8)
.addItem(MItemTags.TRITANIUM_NUGGETS, 4)
.addItem(MItemTags.COPPER_WIRES, 2)
.build()
serializer.accept(SWIM_BOOSTERS_3)
val STEP_ASSIST = AndroidResearchType.Builder(modLocation(MNames.STEP_ASSIST)) val STEP_ASSIST = AndroidResearchType.Builder(modLocation(MNames.STEP_ASSIST))
.withExperience(24) .withExperience(24)
.addFeatureResult(AndroidFeatures.STEP_ASSIST) .addFeatureResult(AndroidFeatures.STEP_ASSIST)
@ -138,7 +103,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS)) .addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS))
.addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_ARMOR)) .addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_ARMOR))
.withIcon(ResearchIcons.ICON_ARMOR) .withIcon(ResearchIcons.ICON_ARMOR)
.addBlocker(OverdriveThatMatters.loc(MNames.ATTACK_BOOST_1), optional = true) .addBlocker(OverdriveThatMatters.loc(MNames.ATTACK_BOOST_1), rigid = true)
.addItem(MItemTags.TRITANIUM_PLATES, 4) .addItem(MItemTags.TRITANIUM_PLATES, 4)
.addItem(MItemTags.COPPER_WIRES, 8) .addItem(MItemTags.COPPER_WIRES, 8)
.build() .build()
@ -163,18 +128,15 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
TranslatableComponent( TranslatableComponent(
"android_research.overdrive_that_matters.limb_overclocking.description", "android_research.overdrive_that_matters.limb_overclocking.description",
(i + 1) * 8, (i + 1) * 8,
(i + 1) * 6, (i + 1) * 6
(i + 1) * 20
) )
) )
.addItem(MItemTags.COPPER_WIRES, 4 + i * 2) .addItem(MItemTags.COPPER_WIRES, 4 + i * 2)
.addFeatureResult(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING), i)
if (i > 0) { if (i > 0) {
research.addFeatureLevel(AndroidFeatures.LIMB_OVERCLOCKING) research.addPrerequisite(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING_LIST[i - 1]), rigid = true)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING_LIST[i - 1]), optional = true)
research.addItem(MItemTags.GOLD_WIRES, i * 2) research.addItem(MItemTags.GOLD_WIRES, i * 2)
} else {
research.addFeatureResult(AndroidFeatures.LIMB_OVERCLOCKING)
} }
research.build() research.build()
@ -193,23 +155,18 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
(i + 1) * 15 (i + 1) * 15
) )
) )
.addItem(MItems.ELECTROMAGNET, 2 + i) .addFeatureResult(AndroidFeatures.ATTACK_BOOST, i)
.addItem(MItemTags.GOLD_WIRES, 4 * i + 8)
.addItem(MItemTags.PISTONS)
.addBlocker(NANOBOTS_ARMOR) .addBlocker(NANOBOTS_ARMOR)
if (i > 0) { if (i > 0) {
research.addFeatureLevel(AndroidFeatures.ATTACK_BOOST) research.addPrerequisite(OverdriveThatMatters.loc(MNames.ATTACK_BOOST_LIST[i - 1]), rigid = true)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.ATTACK_BOOST_LIST[i - 1]), optional = true)
} else {
research.addFeatureResult(AndroidFeatures.ATTACK_BOOST)
} }
research.build() research.build()
}) })
regenList.add(run { regenList.add(run {
val research = AndroidResearchType.Builder(modLocation(MNames.NANOBOTS_REGENERATION_LIST[i])) val regeneration = AndroidResearchType.Builder(modLocation(MNames.NANOBOTS_REGENERATION_LIST[i]))
.withExperience(20 + i * 6) .withExperience(20 + i * 6)
.withIconText(TextComponent((i + 1).toString())) .withIconText(TextComponent((i + 1).toString()))
.withIcon(ResearchIcons.ICON_NANOBOTS) .withIcon(ResearchIcons.ICON_NANOBOTS)
@ -222,16 +179,15 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
.addItem(MItems.MATTER_CAPACITOR_PARTS, 1) .addItem(MItems.MATTER_CAPACITOR_PARTS, 1)
.addItem(Items.SUGAR, 2 + i * 2) .addItem(Items.SUGAR, 2 + i * 2)
.addItem(Tags.Items.DUSTS_REDSTONE, 2 + i * 2) .addItem(Tags.Items.DUSTS_REDSTONE, 2 + i * 2)
.addFeatureResult(AndroidFeatures.NANOBOTS_REGENERATION, i)
if (i > 0) { if (i > 0) {
research.addFeatureLevel(AndroidFeatures.NANOBOTS_REGENERATION) regeneration.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS_REGENERATION_LIST[i - 1]), rigid = true)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS_REGENERATION_LIST[i - 1]), optional = true)
} else { } else {
research.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS), optional = true) regeneration.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS), rigid = true)
research.addFeatureResult(AndroidFeatures.NANOBOTS_REGENERATION)
} }
research.build() regeneration.build()
}) })
} }
@ -260,7 +216,10 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
.addItem(MItemTags.TRITANIUM_PLATES, 2 + i * 2) .addItem(MItemTags.TRITANIUM_PLATES, 2 + i * 2)
.addItem(Items.SUGAR, 1 + i) .addItem(Items.SUGAR, 1 + i)
.addItem(MItems.ELECTROMAGNET) .addItem(MItems.ELECTROMAGNET)
.addResult(AndroidResearchResults.NANOBOTS_ARMOR_STRENGTH) .addFeatureResult(AndroidFeatures.NANOBOTS_ARMOR, 0,
transformersUp = listOf(NanobotsArmorFeature.STRENGTH_TRANSFORMER_UP.bind(level)),
transformersDown = listOf(NanobotsArmorFeature.STRENGTH_TRANSFORMER_DOWN.bind(level)),
)
.build() .build()
}) })
@ -284,7 +243,10 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
) )
) )
.addItem(Tags.Items.DUSTS_REDSTONE, 4 + i * 4) .addItem(Tags.Items.DUSTS_REDSTONE, 4 + i * 4)
.addResult(AndroidResearchResults.NANOBOTS_ARMOR_SPEED) .addFeatureResult(AndroidFeatures.NANOBOTS_ARMOR, 0,
transformersUp = listOf(NanobotsArmorFeature.SPEED_TRANSFORMER_UP.bind(level)),
transformersDown = listOf(NanobotsArmorFeature.SPEED_TRANSFORMER_DOWN.bind(level)),
)
.build() .build()
}) })
} }
@ -299,7 +261,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.SHOCKWAVE)) AndroidResearchType.Builder(modLocation(MNames.SHOCKWAVE))
.withExperience(40) .withExperience(40)
.withDescription(0 .. 1) .withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.SHOCKWAVE) .appendDescription(ShockwaveFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_SHOCKWAVE) .withIcon(ResearchIcons.ICON_SHOCKWAVE)
.addFeatureResult(AndroidFeatures.SHOCKWAVE) .addFeatureResult(AndroidFeatures.SHOCKWAVE)
.addPrerequisite(attackBoostList[2]) .addPrerequisite(attackBoostList[2])
@ -314,7 +276,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.ITEM_MAGNET)) AndroidResearchType.Builder(modLocation(MNames.ITEM_MAGNET))
.withExperience(28) .withExperience(28)
.withDescription(0 .. 1) .withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.ITEM_MAGNET) .appendDescription(ItemMagnetFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_ITEM_MAGNET) .withIcon(ResearchIcons.ICON_ITEM_MAGNET)
.addFeatureResult(AndroidFeatures.ITEM_MAGNET) .addFeatureResult(AndroidFeatures.ITEM_MAGNET)
.addPrerequisite(STEP_ASSIST) .addPrerequisite(STEP_ASSIST)
@ -330,9 +292,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_1")) AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_1"))
.withExperience(25) .withExperience(25)
.withDescription() .withDescription()
.withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(1)) .appendDescription(FallDampenersFeature.DESCRIPTION.bind(1))
.withIcon(ResearchIcons.ICON_FEATHER_FALLING) .withIcon(ResearchIcons.ICON_FEATHER_FALLING)
.addFeatureResult(AndroidFeatures.FALL_DAMPENERS) .addFeatureResult(AndroidFeatures.FALL_DAMPENERS, 0)
.addPrerequisite(STEP_ASSIST) .addPrerequisite(STEP_ASSIST)
.addItem(MItems.ELECTROMAGNET, 2) .addItem(MItems.ELECTROMAGNET, 2)
.addItem(ItemTags.WOOL, 2) .addItem(ItemTags.WOOL, 2)
@ -343,9 +305,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_2")) AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_2"))
.withExperience(30) .withExperience(30)
.withDescription() .withDescription()
.withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(2)) .appendDescription(FallDampenersFeature.DESCRIPTION.bind(2))
.withIcon(ResearchIcons.ICON_FEATHER_FALLING) .withIcon(ResearchIcons.ICON_FEATHER_FALLING)
.addFeatureLevel(AndroidFeatures.FALL_DAMPENERS) .addFeatureResult(AndroidFeatures.FALL_DAMPENERS, 1)
.addPrerequisite(FALL_DAMPENERS_1) .addPrerequisite(FALL_DAMPENERS_1)
.addItem(MItemTags.GOLD_PLATES, 2) .addItem(MItemTags.GOLD_PLATES, 2)
.addItem(MItemTags.COPPER_WIRES, 4) .addItem(MItemTags.COPPER_WIRES, 4)
@ -357,9 +319,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_3")) AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_3"))
.withExperience(35) .withExperience(35)
.withDescription(0 .. 1) .withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(3)) .appendDescription(FallDampenersFeature.DESCRIPTION.bind(3))
.withIcon(ResearchIcons.ICON_FEATHER_FALLING) .withIcon(ResearchIcons.ICON_FEATHER_FALLING)
.addFeatureLevel(AndroidFeatures.FALL_DAMPENERS) .addFeatureResult(AndroidFeatures.FALL_DAMPENERS, 2)
.addPrerequisite(FALL_DAMPENERS_2) .addPrerequisite(FALL_DAMPENERS_2)
.addItem(MItemTags.ADVANCED_CIRCUIT, 2) .addItem(MItemTags.ADVANCED_CIRCUIT, 2)
.addItem(Tags.Items.GEMS_DIAMOND, 4) .addItem(Tags.Items.GEMS_DIAMOND, 4)
@ -375,7 +337,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.ENDER_TELEPORTER)) AndroidResearchType.Builder(modLocation(MNames.ENDER_TELEPORTER))
.withExperience(35) .withExperience(35)
.withDescription() .withDescription()
.withDescription(AndroidResearchDescriptions.ENDER_TELEPORTER) .appendDescription(EnderTeleporterFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_ENDER_TELEPORT) .withIcon(ResearchIcons.ICON_ENDER_TELEPORT)
.addFeatureResult(AndroidFeatures.ENDER_TELEPORTER) .addFeatureResult(AndroidFeatures.ENDER_TELEPORTER)
.addPrerequisite(FALL_DAMPENERS_1) .addPrerequisite(FALL_DAMPENERS_1)
@ -388,13 +350,27 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
serializer.accept(ENDER_TELEPORTER) serializer.accept(ENDER_TELEPORTER)
val PHANTOM_ATTRACTOR =
AndroidResearchType.Builder(modLocation(MNames.PHANTOM_ATTRACTOR))
.withExperience(20)
.withDescription()
.withIcon(ResearchIcons.ICON_PHANTOM_ATTRACTOR)
.addFeatureResult(AndroidFeatures.PHANTOM_ATTRACTOR)
.addPrerequisite(NANOBOTS)
.addItem(MItems.PHANTOM_ATTRACTOR)
.addItem(MItemTags.COPPER_WIRES, 2)
.addItem(MItemTags.TRITANIUM_PLATES, 2)
.build()
serializer.accept(PHANTOM_ATTRACTOR)
val JUMP_BOOST_1 = val JUMP_BOOST_1 =
AndroidResearchType.Builder(modLocation(MNames.JUMP_BOOST + "_1")) AndroidResearchType.Builder(modLocation(MNames.JUMP_BOOST + "_1"))
.withExperience(27) .withExperience(27)
.withDescription(0 .. 1) .withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.JUMP_BOOST) .appendDescription(JumpBoostFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_JUMP_BOOST) .withIcon(ResearchIcons.ICON_JUMP_BOOST)
.addFeatureResult(AndroidFeatures.JUMP_BOOST) .addFeatureResult(AndroidFeatures.JUMP_BOOST, 0)
.addItem(MItemTags.PISTONS, 2) .addItem(MItemTags.PISTONS, 2)
.addItem(MItemTags.GOLD_WIRES, 4) .addItem(MItemTags.GOLD_WIRES, 4)
.addItem(MItems.ELECTROMAGNET, 2) .addItem(MItems.ELECTROMAGNET, 2)
@ -406,9 +382,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.JUMP_BOOST + "_2")) AndroidResearchType.Builder(modLocation(MNames.JUMP_BOOST + "_2"))
.withExperience(34) .withExperience(34)
.withDescription() .withDescription()
.withDescription(AndroidResearchDescriptions.JUMP_BOOST) .appendDescription(JumpBoostFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_JUMP_BOOST) .withIcon(ResearchIcons.ICON_JUMP_BOOST)
.addFeatureLevel(AndroidFeatures.JUMP_BOOST) .addFeatureResult(AndroidFeatures.JUMP_BOOST, 1)
.addItem(MItems.ELECTRIC_PARTS, 4) .addItem(MItems.ELECTRIC_PARTS, 4)
.addItem(MItems.ELECTROMAGNET, 4) .addItem(MItems.ELECTROMAGNET, 4)
.addPrerequisite(JUMP_BOOST_1) .addPrerequisite(JUMP_BOOST_1)
@ -419,20 +395,20 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
serializer.accept(JUMP_BOOST_2) serializer.accept(JUMP_BOOST_2)
with(lang) { with(lang) {
misc("fall_dampeners.description", "Reduces fall damage by %s%% and increases fall damage flat resist by %s half a hearts") { misc("fall_dampeners.description", "Reduces fall damage by %s%%") {
russian("Уменьшает урон от падения на %s%% и повышает сопротивление урону от падения на %s полусердец") russian("Уменьшает урон от падения на %s%%")
} }
add(limbList[0], "Limb Overclocking %s") { add(limbList[0], "Limb Overclocking %s") {
russian("Разгон конечностей %s") russian("Разгон Конечностей %s")
} }
add(limbList[0], "description", "Boosts mobility by %s%%, attack speed by %s%% and brushing speed by %s%%") { add(limbList[0], "description", "Boosts mobility by %s%% and attack speed by %s%%") {
russian("Увеличивает мобильность на %s%%, скорость атак на %s%% и скорость чистки блоков на %s%%") russian("Увеличивает мобильность на %s%% и скорость атак на %s%%")
} }
add(AIR_BAGS, "Air Bags") { add(AIR_BAGS, "Air Bags") {
russian("Воздушные мешки") russian("Воздушные Мешки")
} }
add(NANOBOTS, "Nanobots") { add(NANOBOTS, "Nanobots") {
russian("Наноботы") russian("Наноботы")
@ -455,64 +431,49 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
} }
add(NANOBOTS_ARMOR, "Nanobots Armor") { add(NANOBOTS_ARMOR, "Nanobots Armor") {
russian("Броня из наноботов") russian("Броня из Наноботов")
} }
add(NANOBOTS_ARMOR, "description", "Allows nanobots to align themselves in cell shape, reducing incoming damage by a %% by absorbing impacts") { add(NANOBOTS_ARMOR, "description", "Allows nanobots to align themselves in cell shape, reducing incoming damage by a %% by absorbing impacts") {
russian("Позволяет наноботам выстраиваться в клеточную структуру, уменьшая внешний урон на определённый проект путём поглощения ударов") russian("Позволяет наноботам выстраиваться в клеточную структуру, уменьшая внешний урон на определённый проект путём поглощения ударов")
} }
add(armorSpeedList[0], "Nanobots Armor Build Speed %s") { add(armorSpeedList[0], "Nanobots Armor Build Speed %s") {
russian("Скорость аостроения слоя брони наноботов %s") russian("Скорость Построения Слоя Брони Наноботов %s")
} }
add(armorSpeedList[0], "description", "Reduces time required for nanobots to form protection layer") { add(armorSpeedList[0], "description", "Reduces time required for nanobots to form protection layer") {
russian("Уменьшает время необходимое наноботам для формирования защитного слоя") russian("Уменьшает время необходимое наноботам для формирования защитного слоя")
} }
add(armorStrengthList[0], "Nanobots Armor Strength %s") { add(armorStrengthList[0], "Nanobots Armor Strength %s") {
russian("Сила слоя брони наноботов %s") russian("Сила Слоя Брони Наноботов %s")
} }
add(armorStrengthList[0], "description", "Increases impact absorption strength of nanobots") { add(armorStrengthList[0], "description", "Increases impact absorption strength of nanobots") {
russian("Увеличивает поглощающею силу брони наноботов") russian("Увеличивает поглощающею силу брони наноботов")
} }
add(EXTENDED_REACH, "Extended Reach") { add(EXTENDED_REACH, "Extended Reach") {
russian("Удлинённые манипуляторы") russian("Удлинённые Манипуляторы")
} }
add(EXTENDED_REACH, "description", "Increases block interaction distance") { add(EXTENDED_REACH, "description", "Increases block interaction distance") {
russian("Увеличивает радиус взаимодействия с блоками") russian("Увеличивает радиус взаимодействия с блоками")
} }
add(IMPROVED_LIMBS, "Improved Limbs") { add(IMPROVED_LIMBS, "Improved Limbs") {
russian("Улучшенные конечности") russian("Улучшенные Конечности")
} }
add(IMPROVED_LIMBS, "description", "Allows limbs to be upgraded") { add(IMPROVED_LIMBS, "description", "Allows limbs to be upgraded") {
russian("Позволяет улучшать конечности") russian("Позволяет улучшать конечности")
} }
add(SWIM_BOOSTERS, "Swim Boosters") {
russian("Плавательные лопасти")
}
add(SWIM_BOOSTERS, "description", "Increases swimming speed by %s%%") {
russian("Ускоряет скорость плавания на %s%%")
}
add(SWIM_BOOSTERS_2, "Swim Boosters 2") {
russian("Плавательные лопасти 2")
}
add(SWIM_BOOSTERS_3, "Swim Boosters 3") {
russian("Плавательные лопасти 3")
}
add(STEP_ASSIST, "Step Assist") { add(STEP_ASSIST, "Step Assist") {
russian("Помощь подъёма") russian("Помощь Подъёма")
} }
add(STEP_ASSIST, "description", "Allows unit to step up whole blocks") { add(STEP_ASSIST, "description", "Allows unit to step up whole blocks") {
russian("Позволяет переступать полные блоки") russian("Позволяет переступать полные блоки")
} }
add(ITEM_MAGNET, "Item Magnet") { add(ITEM_MAGNET, "Item Magnet") {
russian("Предметный магнит") russian("Предметный Магнит")
} }
add(ITEM_MAGNET, "description0", "Pulls nearby items while active") { add(ITEM_MAGNET, "description0", "Pulls nearby items while active") {
russian("Притягивает ближайшие предметы пока активен") russian("Притягивает ближайшие предметы пока активен")
@ -522,21 +483,21 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
} }
add(FALL_DAMPENERS_1, "Fall Dampeners") { add(FALL_DAMPENERS_1, "Fall Dampeners") {
russian("Поглотители инерции") russian("Поглотители Инерции")
} }
add(FALL_DAMPENERS_1, "description", "Installs basic equipment in limbs to negate some fall damage") { add(FALL_DAMPENERS_1, "description", "Installs basic equipment in limbs to negate some fall damage") {
russian("Обустраивает конечности примитивными деталями для небольшого смягчения падения") russian("Обустраивает конечности примитивными деталями для небольшого смягчения падения")
} }
add(FALL_DAMPENERS_2, "Fall Dampeners 2") { add(FALL_DAMPENERS_2, "Fall Dampeners 2") {
russian("Поглотители инерции 2") russian("Поглотители Инерции 2")
} }
add(FALL_DAMPENERS_2, "description", "Installs micro displacing and dampening equipment in limbs to negate great deal of fall damage") { add(FALL_DAMPENERS_2, "description", "Installs micro displacing and dampening equipment in limbs to negate great deal of fall damage") {
russian("Оборудует конечности микро смещающимися и смягчающим оборудованием, которое поглощает значительный урон от падения") russian("Оборудует конечности микро смещающимися и смягчающим оборудованием, которое поглощает значительный урон от падения")
} }
add(FALL_DAMPENERS_3, "Fall Dampeners 3") { add(FALL_DAMPENERS_3, "Fall Dampeners 3") {
russian("Поглотители инерции 3") russian("Поглотители Инерции 3")
} }
add(FALL_DAMPENERS_3, "description0", "Installs autonomous fall damage avoidance calculation matrices and hardening to crucial parts") { add(FALL_DAMPENERS_3, "description0", "Installs autonomous fall damage avoidance calculation matrices and hardening to crucial parts") {
russian("Устанавливает автономные матрицы калькуляции избегания урона от падения, а так же усиливает защиту важных деталей") russian("Устанавливает автономные матрицы калькуляции избегания урона от падения, а так же усиливает защиту важных деталей")
@ -546,7 +507,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
} }
add(SHOCKWAVE, "Shockwave Pulsator") { add(SHOCKWAVE, "Shockwave Pulsator") {
russian("Генератор ударных волн") russian("Генератор Ударных Волн")
} }
add(SHOCKWAVE, "description0", "Releases a shockwave, damaging everything in small radius, as you quickly land on ground") { add(SHOCKWAVE, "description0", "Releases a shockwave, damaging everything in small radius, as you quickly land on ground") {
russian("Вызывает ударную волну при стремительном падении на землю, нанося урон всему, что вас окружает") russian("Вызывает ударную волну при стремительном падении на землю, нанося урон всему, что вас окружает")
@ -555,8 +516,15 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
russian("Используйте с осторожностью, так как данная технология сама по себе не поглащает урон от падения!") russian("Используйте с осторожностью, так как данная технология сама по себе не поглащает урон от падения!")
} }
add(PHANTOM_ATTRACTOR, "Builtin Phantom Attractor") {
russian("Встроенный Приманщик Фантомов")
}
add(PHANTOM_ATTRACTOR, "description", "Allows to attract phantoms while active under same conditions as non-Androids") {
russian("Позволяет привлекать фантомов под теми же условиями, как и не Андроиды")
}
add(JUMP_BOOST_1, "Jump Boost") { add(JUMP_BOOST_1, "Jump Boost") {
russian("Усилитель прыжка") russian("Усилитель Прыжка")
} }
add(JUMP_BOOST_1, "description0", "Allows to perform higher jump") { add(JUMP_BOOST_1, "description0", "Allows to perform higher jump") {
russian("Позволяет совершить высокий прыжок") russian("Позволяет совершить высокий прыжок")
@ -566,7 +534,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
} }
add(JUMP_BOOST_2, "Jump Boost 2") { add(JUMP_BOOST_2, "Jump Boost 2") {
russian("Усилитель прыжка 2") russian("Усилитель Прыжка 2")
} }
add(JUMP_BOOST_2, "description", "Allows to perform extra higher jump") { add(JUMP_BOOST_2, "description", "Allows to perform extra higher jump") {
russian("Позволяет совершить ещё более высокий прыжок") russian("Позволяет совершить ещё более высокий прыжок")
@ -580,14 +548,14 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
} }
add(NIGHT_VISION, "Night Vision") { add(NIGHT_VISION, "Night Vision") {
russian("Ночное зрение") russian("Ночное Зрение")
} }
add(NIGHT_VISION, "description", "Allows to clearly see in the dark") { add(NIGHT_VISION, "description", "Allows to clearly see in the dark") {
russian("Позволяет видеть в темноте") russian("Позволяет видеть в темноте")
} }
add(attackBoostList[0], "Attack Boost %s") { add(attackBoostList[0], "Attack Boost %s") {
russian("Усиление атаки %s") russian("Усиление Атаки %s")
} }
add(attackBoostList[0], "description", "Increases total melee attack strength by %s%%") { add(attackBoostList[0], "description", "Increases total melee attack strength by %s%%") {
russian("Увеличивает урон в ближнем бою на %s%%") russian("Увеличивает урон в ближнем бою на %s%%")

View File

@ -1,10 +1,11 @@
package ru.dbotthepony.mc.otm.datagen package ru.dbotthepony.mc.otm.datagen
import net.minecraft.resources.ResourceLocation
import net.minecraft.sounds.SoundEvent import net.minecraft.sounds.SoundEvent
import net.neoforged.neoforge.common.data.SoundDefinition import net.minecraftforge.common.data.SoundDefinition
import net.neoforged.neoforge.common.data.SoundDefinitionsProvider import net.minecraftforge.common.data.SoundDefinitionsProvider
import net.neoforged.neoforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents import ru.dbotthepony.mc.otm.registry.MSoundEvents
fun SoundDefinition.subtitle(value: SoundEvent): SoundDefinition { fun SoundDefinition.subtitle(value: SoundEvent): SoundDefinition {
return subtitle("otm.sound." + value.location.path) return subtitle("otm.sound." + value.location.path)
@ -12,57 +13,32 @@ fun SoundDefinition.subtitle(value: SoundEvent): SoundDefinition {
class SoundDataProvider(event: GatherDataEvent) : SoundDefinitionsProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) { class SoundDataProvider(event: GatherDataEvent) : SoundDefinitionsProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
override fun registerSounds() { override fun registerSounds() {
add( add(MSoundEvents.PLASMA_WEAPON_OVERHEAT,
MSoundEvents.PLASMA_WEAPON_OVERHEAT,
definition().subtitle("otm.sound.plasma_weapon_overheat") definition().subtitle("otm.sound.plasma_weapon_overheat")
.with(SoundDefinition.Sound.sound(modLocation("item/plasma_weapon_overheat"), SoundDefinition.SoundType.SOUND))) .with(SoundDefinition.Sound.sound(modLocation("item/plasma_weapon_overheat"), SoundDefinition.SoundType.SOUND)))
add( add(MSoundEvents.PLAYER_BECOME_ANDROID,
MSoundEvents.PLAYER_BECOME_ANDROID,
definition().subtitle("otm.sound.player_become_android") definition().subtitle("otm.sound.player_become_android")
.with(SoundDefinition.Sound.sound(modLocation("player_become_android"), SoundDefinition.SoundType.SOUND))) .with(SoundDefinition.Sound.sound(modLocation("player_become_android"), SoundDefinition.SoundType.SOUND)))
add( add(MSoundEvents.RIFLE_SHOT,
MSoundEvents.RIFLE_SHOT,
definition().subtitle("otm.sound.rifle_shot") definition().subtitle("otm.sound.rifle_shot")
.with(SoundDefinition.Sound.sound(modLocation("item/rifle_shot"), SoundDefinition.SoundType.SOUND))) .with(SoundDefinition.Sound.sound(modLocation("item/rifle_shot"), SoundDefinition.SoundType.SOUND)))
simple(MSoundEvents.CARGO_CRATE_OPEN) simple(MSoundEvents.CARGO_CRATE_OPEN)
add( add(MSoundEvents.ANDROID_JUMP_BOOST,
MSoundEvents.ANDROID_JUMP_BOOST,
definition().subtitle("otm.sound.android.jump_boost") definition().subtitle("otm.sound.android.jump_boost")
.with(SoundDefinition.Sound.sound(modLocation("android/jump_boost"), SoundDefinition.SoundType.SOUND))) .with(SoundDefinition.Sound.sound(modLocation("android/jump_boost"), SoundDefinition.SoundType.SOUND)))
add( add(MSoundEvents.ANDROID_SHOCKWAVE,
MSoundEvents.ANDROID_SHOCKWAVE,
definition().subtitle("otm.sound.android.shockwave") definition().subtitle("otm.sound.android.shockwave")
.with(SoundDefinition.Sound.sound(modLocation("android/shockwave"), SoundDefinition.SoundType.SOUND))) .with(SoundDefinition.Sound.sound(modLocation("android/shockwave"), SoundDefinition.SoundType.SOUND)))
add( add(MSoundEvents.ANDROID_PROJ_PARRY,
MSoundEvents.BLACK_HOLE,
definition().subtitle("otm.sound.black_hole")
.with(SoundDefinition.Sound.sound(modLocation("singularity/amb_singularity"), SoundDefinition.SoundType.SOUND)
.attenuationDistance(32)
.stream()
))
add(
MSoundEvents.LOADER_AMBIENT,
definition().subtitle("otm.sound.entity.loader.loader_ambient")
.with(
SoundDefinition.Sound.sound(modLocation("entity/loader/loader_ambient"), SoundDefinition.SoundType.SOUND)
.attenuationDistance(32)
.stream(),
SoundDefinition.Sound.sound(modLocation("entity/loader/loader_ambient2"), SoundDefinition.SoundType.SOUND)
.attenuationDistance(32)
.stream()
))
add(
MSoundEvents.ANDROID_PROJ_PARRY,
definition().subtitle("otm.sound.android.projectile_parry") definition().subtitle("otm.sound.android.projectile_parry")
.with(SoundDefinition.Sound.sound(modLocation("android/punch_projectile"), SoundDefinition.SoundType.SOUND))) .with(SoundDefinition.Sound.sound(modLocation("android/punch_projectile"), SoundDefinition.SoundType.SOUND))
)
} }
private inline fun add(value: SoundEvent, block: SoundDefinition.() -> Unit) { private inline fun add(value: SoundEvent, block: SoundDefinition.() -> Unit) {

View File

@ -1,199 +0,0 @@
package ru.dbotthepony.mc.otm.datagen
import net.minecraft.core.HolderSet
import net.minecraft.core.registries.Registries
import net.minecraft.data.worldgen.BootstrapContext
import net.minecraft.resources.ResourceKey
import net.minecraft.tags.BiomeTags
import net.minecraft.tags.BlockTags
import net.minecraft.util.valueproviders.ClampedNormalFloat
import net.minecraft.util.valueproviders.ClampedNormalInt
import net.minecraft.util.valueproviders.ConstantFloat
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.level.levelgen.GenerationStep
import net.minecraft.world.level.levelgen.VerticalAnchor
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature
import net.minecraft.world.level.levelgen.feature.Feature
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration
import net.minecraft.world.level.levelgen.heightproviders.VeryBiasedToBottomHeight
import net.minecraft.world.level.levelgen.placement.CountPlacement
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement
import net.minecraft.world.level.levelgen.placement.InSquarePlacement
import net.minecraft.world.level.levelgen.placement.PlacedFeature
import net.minecraft.world.level.levelgen.placement.RarityFilter
import net.minecraft.world.level.levelgen.structure.templatesystem.TagMatchTest
import net.neoforged.neoforge.common.world.BiomeModifier
import net.neoforged.neoforge.registries.NeoForgeRegistries
import ru.dbotthepony.mc.otm.util.math.Decimal
import ru.dbotthepony.mc.otm.data.world.EllipsoidPlacement
import ru.dbotthepony.mc.otm.data.world.StandardDeviationHeightProvider
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.data.MWorldGenFeatures
import ru.dbotthepony.mc.otm.server.world.feature.BlackHolePlacerFeature
private object ConfiguredFeatures {
val TRITANIUM_ORE = key("tritanium_ore")
val DILITHIUM = key("dilithium")
val BLACK_HOLE = key("black_hole")
private fun key(name: String): ResourceKey<ConfiguredFeature<*, *>> {
return ResourceKey.create(Registries.CONFIGURED_FEATURE, modLocation(name))
}
}
fun registerConfiguredFeatures(context: BootstrapContext<ConfiguredFeature<*, *>>) {
val stone = TagMatchTest(BlockTags.STONE_ORE_REPLACEABLES)
val deepslate = TagMatchTest(BlockTags.DEEPSLATE_ORE_REPLACEABLES)
run {
val target = listOf(
OreConfiguration.target(stone, MBlocks.TRITANIUM_ORE.defaultBlockState()),
OreConfiguration.target(deepslate, MBlocks.DEEPSLATE_TRITANIUM_ORE.defaultBlockState()),
)
context.register(ConfiguredFeatures.TRITANIUM_ORE, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 9)))
}
run {
val target = listOf(
OreConfiguration.target(stone, MBlocks.DILITHIUM_ORE.defaultBlockState()),
OreConfiguration.target(deepslate, MBlocks.DEEPSLATE_DILITHIUM_ORE.defaultBlockState()),
)
context.register(ConfiguredFeatures.DILITHIUM, ConfiguredFeature(Feature.ORE, OreConfiguration(target, 3)))
}
context.register(ConfiguredFeatures.BLACK_HOLE, ConfiguredFeature(
MWorldGenFeatures.BLACK_HOLE_PLACER,
BlackHolePlacerFeature.Config(Decimal("0.25"), Decimal(1))))
}
private object PlacedFeatures {
val NORMAL_TRITANIUM = key("normal_tritanium")
val DEEP_TRITANIUM = key("deep_tritanium")
val CLOUD_TITANIUM = key("cloud_tritanium")
val DILITHIUM = key("dilithium")
val BLACK_HOLE = key("black_hole")
private fun key(name: String): ResourceKey<PlacedFeature> {
return ResourceKey.create(Registries.PLACED_FEATURE, modLocation(name))
}
}
fun registerPlacedFeatures(context: BootstrapContext<PlacedFeature>) {
val configured = context.lookup(Registries.CONFIGURED_FEATURE)
run {
val ore = configured.getOrThrow(ConfiguredFeatures.TRITANIUM_ORE)
context.register(PlacedFeatures.NORMAL_TRITANIUM, PlacedFeature(
ore,
listOf(
CountPlacement.of(UniformInt.of(2, 6)),
InSquarePlacement.spread(),
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(10), 15.0))
)
))
context.register(PlacedFeatures.DEEP_TRITANIUM, PlacedFeature(
ore,
listOf(
CountPlacement.of(UniformInt.of(4, 8)),
InSquarePlacement.spread(),
HeightRangePlacement.of(VeryBiasedToBottomHeight.of(VerticalAnchor.aboveBottom(4), VerticalAnchor.absolute(0), 16))
)
))
context.register(PlacedFeatures.CLOUD_TITANIUM, PlacedFeature(
ore,
listOf(
RarityFilter.onAverageOnceEvery(16),
InSquarePlacement.spread(),
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(10), 15.0)),
EllipsoidPlacement(
x = ClampedNormalInt.of(0f, 6f, Int.MIN_VALUE, Int.MAX_VALUE),
y = ClampedNormalInt.of(0f, 12f, Int.MIN_VALUE, Int.MAX_VALUE),
z = ClampedNormalInt.of(0f, 6f, Int.MIN_VALUE, Int.MAX_VALUE),
count = ClampedNormalInt.of(60f, 60f, 40, 160),
xLength = ClampedNormalFloat.of(11f, 4f, 6f, 14f),
yLength = ClampedNormalFloat.of(11f, 4f, 6f, 14f),
zLength = ClampedNormalFloat.of(11f, 4f, 6f, 14f),
)
)
))
}
run {
val ore = configured.getOrThrow(ConfiguredFeatures.DILITHIUM)
context.register(PlacedFeatures.DILITHIUM, PlacedFeature(
ore,
listOf(
RarityFilter.onAverageOnceEvery(12),
InSquarePlacement.spread(),
HeightRangePlacement.of(StandardDeviationHeightProvider(VerticalAnchor.absolute(0), 15.0)),
EllipsoidPlacement(
x = ClampedNormalInt.of(0f, 8f, Int.MIN_VALUE, Int.MAX_VALUE),
y = ClampedNormalInt.of(0f, 20f, Int.MIN_VALUE, Int.MAX_VALUE),
z = ClampedNormalInt.of(0f, 8f, Int.MIN_VALUE, Int.MAX_VALUE),
count = ClampedNormalInt.of(200f, 200f, 200, 600),
xLength = ClampedNormalFloat.of(11f, 4f, 8f, 14f),
// allow crystals to generate as far as standard deviation allows
// to increase chance for player to discover crystal vein
yLength = ConstantFloat.of(60f),
zLength = ClampedNormalFloat.of(11f, 4f, 8f, 14f),
)
)
))
}
val blackHole = configured.getOrThrow(ConfiguredFeatures.BLACK_HOLE)
context.register(PlacedFeatures.BLACK_HOLE, PlacedFeature(
blackHole,
listOf(
RarityFilter.onAverageOnceEvery(1000),
InSquarePlacement.spread(),
HeightRangePlacement.uniform(VerticalAnchor.absolute(64), VerticalAnchor.absolute(128))
)
))
}
private object BiomeModifiers {
val ORES = key("ores")
val BLACK_HOLE = key("black_hole")
private fun key(name: String): ResourceKey<BiomeModifier> {
return ResourceKey.create(NeoForgeRegistries.Keys.BIOME_MODIFIERS, modLocation(name))
}
}
fun registerBiomeModifiers(context: BootstrapContext<BiomeModifier>) {
val placed = context.lookup(Registries.PLACED_FEATURE)
val biomes = context.lookup(Registries.BIOME)
context.register(
BiomeModifiers.ORES,
net.neoforged.neoforge.common.world.BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(
placed.getOrThrow(PlacedFeatures.NORMAL_TRITANIUM),
placed.getOrThrow(PlacedFeatures.DEEP_TRITANIUM),
placed.getOrThrow(PlacedFeatures.CLOUD_TITANIUM),
placed.getOrThrow(PlacedFeatures.DILITHIUM),
),
GenerationStep.Decoration.UNDERGROUND_ORES
)
)
context.register(
BiomeModifiers.BLACK_HOLE,
net.neoforged.neoforge.common.world.BiomeModifiers.AddFeaturesBiomeModifier(
biomes.getOrThrow(BiomeTags.IS_OVERWORLD),
HolderSet.direct(
placed.getOrThrow(PlacedFeatures.BLACK_HOLE)
),
GenerationStep.Decoration.SURFACE_STRUCTURES
)
)
}

View File

@ -1,27 +1,28 @@
package ru.dbotthepony.mc.otm.datagen.advancements package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.AdvancementHolder import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementRewards import net.minecraft.advancements.AdvancementRewards
import net.minecraft.advancements.AdvancementRequirements.Strategy import net.minecraft.advancements.FrameType
import net.minecraft.advancements.AdvancementType import net.minecraft.advancements.RequirementsStrategy
import net.minecraft.advancements.critereon.InventoryChangeTrigger import net.minecraft.advancements.critereon.InventoryChangeTrigger
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import ru.dbotthepony.mc.otm.util.registryName import net.minecraftforge.common.data.ExistingFileHelper
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.server.triggers.BlackHoleTrigger import ru.dbotthepony.mc.otm.triggers.BlackHoleTrigger
import ru.dbotthepony.mc.otm.server.triggers.NailedEntityTrigger import ru.dbotthepony.mc.otm.triggers.NailedEntityTrigger
import java.util.function.Consumer import java.util.function.Consumer
fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLanguageProvider) { fun addAdvancements(serializer: Consumer<Advancement>, existingFileHelper: ExistingFileHelper, lang: MatteryLanguageProvider) {
val translation = lang.MultiBuilder("otm.advancements.regular") val translation = lang.MultiBuilder("otm.advancements.regular")
val root = AdvancementBuilder() val root = AdvancementBuilder()
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.display( .display(
itemStack = ItemStack(MItems.TRITANIUM_INGOT), itemStack = ItemStack(MItems.TRITANIUM_INGOT),
title = translation.add("root", "Overdrive That Matters"), title = translation.add("root", "Overdrive That Matters"),
@ -35,9 +36,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
.addCriterion("has_tritanium_ore", criterion(MItemTags.TRITANIUM_ORES)) .addCriterion("has_tritanium_ore", criterion(MItemTags.TRITANIUM_ORES))
.addCriterion("has_tritanium_ore_clump", criterion(MItemTags.TRITANIUM_ORE_CLUMPS)) .addCriterion("has_tritanium_ore_clump", criterion(MItemTags.TRITANIUM_ORE_CLUMPS))
.addCriterion("has_tritanium_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(MItems.TRITANIUM_INGOT)) .addCriterion("has_tritanium_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(MItems.TRITANIUM_INGOT))
.save(serializer, modLocation("regular/root")) .save(serializer, modLocation("regular/root"), existingFileHelper)
addMachineAdvancements(serializer, lang, root)
val crude = AdvancementBuilder() val crude = AdvancementBuilder()
.parent(root) .parent(root)
@ -51,7 +50,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_item", criterion(MItems.BATTERY_CRUDE)) .addCriterion("has_item", criterion(MItems.BATTERY_CRUDE))
.save(serializer, modLocation("regular/crude_battery")) .save(serializer, modLocation("regular/crude_battery"), existingFileHelper)
val normal = AdvancementBuilder() val normal = AdvancementBuilder()
.parent(crude) .parent(crude)
@ -65,7 +64,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_item", criterion(MItems.BATTERY_NORMAL)) .addCriterion("has_item", criterion(MItems.BATTERY_NORMAL))
.save(serializer, modLocation("regular/normal_battery")) .save(serializer, modLocation("regular/normal_battery"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(normal) .parent(normal)
@ -79,7 +78,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_item", criterion(MItems.BATTERY_DENSE)) .addCriterion("has_item", criterion(MItems.BATTERY_DENSE))
.save(serializer, modLocation("regular/dense_battery")) .save(serializer, modLocation("regular/dense_battery"), existingFileHelper)
val capacitor = AdvancementBuilder() val capacitor = AdvancementBuilder()
.parent(normal) .parent(normal)
@ -93,7 +92,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_item", criterion(MItems.BATTERY_CAPACITOR)) .addCriterion("has_item", criterion(MItems.BATTERY_CAPACITOR))
.save(serializer, modLocation("regular/capacitor_battery")) .save(serializer, modLocation("regular/capacitor_battery"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(capacitor) .parent(capacitor)
@ -105,10 +104,10 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("energy_sword.desc", "Wield a High-Frequency Blade, a melee weapon intended to slice Creepers into creep-cakes") { description = translation.add("energy_sword.desc", "Wield a High-Frequency Blade, a melee weapon intended to slice Creepers into creep-cakes") {
russian("Получите высокочастотный клинок, оружие ближнего боя предназначенное для нарезания Криперов на крипо-тортики") russian("Получите высокочастотный клинок, оружие ближнего боя предназначенное для нарезания Криперов на крипо-тортики")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.addCriterion("has_item", criterion(MItems.ENERGY_SWORD)) .addCriterion("has_item", criterion(MItems.ENERGY_SWORD))
.save(serializer, modLocation("regular/energy_sword")) .save(serializer, modLocation("regular/energy_sword"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(normal) .parent(normal)
@ -120,15 +119,15 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("quantum_battery.desc", "Put together a Quantum Battery, powered by Ender technologies") { description = translation.add("quantum_battery.desc", "Put together a Quantum Battery, powered by Ender technologies") {
russian("Создайте квантовый аккумулятор, пропитанную технологиями Края") russian("Создайте квантовый аккумулятор, пропитанную технологиями Края")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.rewards(AdvancementRewards.Builder.experience(50)) .rewards(AdvancementRewards.Builder.experience(50))
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.addCriterion("has_item0", criterion(MItems.QUANTUM_BATTERY)) .addCriterion("has_item0", criterion(MItems.QUANTUM_BATTERY))
.addCriterion("has_item1", criterion(MItems.QUANTUM_CAPACITOR)) .addCriterion("has_item1", criterion(MItems.QUANTUM_CAPACITOR))
.save(serializer, modLocation("regular/quantum_battery")) .save(serializer, modLocation("regular/quantum_battery"), existingFileHelper)
val zpm = AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
.display( .display(
itemStack = ItemStack(MItems.ZPM_BATTERY), itemStack = ItemStack(MItems.ZPM_BATTERY),
@ -138,14 +137,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("zpm_battery.desc", "Find Zero Point Module, something from different multiverse of ours, created using technologies lost in time in all possible multiverses") { description = translation.add("zpm_battery.desc", "Find Zero Point Module, something from different multiverse of ours, created using technologies lost in time in all possible multiverses") {
russian("Найдите модуль нулевой точки, вещь из другой мультивселенной, созданная с использованием технологий, потерянных во времени во всех возможных мультивслеленных") russian("Найдите модуль нулевой точки, вещь из другой мультивселенной, созданная с использованием технологий, потерянных во времени во всех возможных мультивслеленных")
}, },
frameType = AdvancementType.CHALLENGE, frameType = FrameType.CHALLENGE,
hidden = true hidden = true
) )
.rewards(AdvancementRewards.Builder.experience(800)) .rewards(AdvancementRewards.Builder.experience(800))
.addCriterion("has_item", criterion(MItems.ZPM_BATTERY)) .addCriterion("has_item", criterion(MItems.ZPM_BATTERY))
.save(serializer, modLocation("regular/zpm_battery")) .save(serializer, modLocation("regular/zpm_battery"), existingFileHelper)
addExopackAdvancements(serializer, lang, root, zpm)
val blackhole = AdvancementBuilder() val blackhole = AdvancementBuilder()
.parent(root) .parent(root)
@ -159,8 +156,8 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
hidden = true hidden = true
) )
.addCriterion("pulled_by_black_hole", BlackHoleTrigger.criterion) .addCriterion("pulled_by_black_hole", BlackHoleTrigger.Instance)
.save(serializer, modLocation("regular/black_hole")) .save(serializer, modLocation("regular/black_hole"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(blackhole) .parent(blackhole)
@ -174,7 +171,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_item", criterion(MItems.BLACK_HOLE_SCANNER)) .addCriterion("has_item", criterion(MItems.BLACK_HOLE_SCANNER))
.save(serializer, modLocation("regular/black_hole_scanner")) .save(serializer, modLocation("regular/black_hole_scanner"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(blackhole) .parent(blackhole)
@ -188,7 +185,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_item", criterion(MItems.GRAVITATION_STABILIZER)) .addCriterion("has_item", criterion(MItems.GRAVITATION_STABILIZER))
.save(serializer, modLocation("regular/stabilizer")) .save(serializer, modLocation("regular/stabilizer"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(blackhole) .parent(blackhole)
@ -202,11 +199,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_item", criterion(MItems.PORTABLE_GRAVITATION_STABILIZER)) .addCriterion("has_item", criterion(MItems.PORTABLE_GRAVITATION_STABILIZER))
.save(serializer, modLocation("regular/portable_stabilizer")) .save(serializer, modLocation("regular/portable_stabilizer"), existingFileHelper)
val ore = AdvancementBuilder() val ore = AdvancementBuilder()
.parent(root) .parent(root)
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.display( .display(
itemStack = ItemStack(MItems.TRITANIUM_ORE_CLUMP), itemStack = ItemStack(MItems.TRITANIUM_ORE_CLUMP),
title = translation.add("ore", "Blue Metal Discovery") { title = translation.add("ore", "Blue Metal Discovery") {
@ -218,7 +215,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
) )
.addCriterion("has_tritanium_ore", criterion(MItemTags.TRITANIUM_ORES)) .addCriterion("has_tritanium_ore", criterion(MItemTags.TRITANIUM_ORES))
.addCriterion("has_tritanium_ore_clump", criterion(MItemTags.TRITANIUM_ORE_CLUMPS)) .addCriterion("has_tritanium_ore_clump", criterion(MItemTags.TRITANIUM_ORE_CLUMPS))
.save(serializer, modLocation("regular/ore")) .save(serializer, modLocation("regular/ore"), existingFileHelper)
val ingot = AdvancementBuilder() val ingot = AdvancementBuilder()
.parent(ore) .parent(ore)
@ -232,7 +229,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_tritanium_ingot", criterion(MItemTags.TRITANIUM_INGOTS)) .addCriterion("has_tritanium_ingot", criterion(MItemTags.TRITANIUM_INGOTS))
.save(serializer, modLocation("regular/ingot")) .save(serializer, modLocation("regular/ingot"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(ingot) .parent(ingot)
@ -246,7 +243,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}, },
) )
.addCriterion("has_tritanium_pickaxe", criterion(MItems.TRITANIUM_PICKAXE)) .addCriterion("has_tritanium_pickaxe", criterion(MItems.TRITANIUM_PICKAXE))
.save(serializer, modLocation("regular/pickaxe")) .save(serializer, modLocation("regular/pickaxe"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(ingot) .parent(ingot)
@ -261,7 +258,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
hidden = true hidden = true
) )
.addCriterion("hoe", criterion(MItems.TRITANIUM_HOE)) .addCriterion("hoe", criterion(MItems.TRITANIUM_HOE))
.save(serializer, modLocation("regular/hoe")) .save(serializer, modLocation("regular/hoe"), existingFileHelper)
val plate = AdvancementBuilder() val plate = AdvancementBuilder()
.parent(ingot) .parent(ingot)
@ -275,7 +272,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
} }
) )
.addCriterion("has_item", criterion(MItemTags.TRITANIUM_PLATES)) .addCriterion("has_item", criterion(MItemTags.TRITANIUM_PLATES))
.save(serializer, modLocation("regular/plate")) .save(serializer, modLocation("regular/plate"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(plate) .parent(plate)
@ -288,12 +285,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Согните немного тритановых пластин вместе с углеродной сеткой в невероятно прочную броню") russian("Согните немного тритановых пластин вместе с углеродной сеткой в невероятно прочную броню")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.addCriterion("has_item0", criterion(MItems.TRITANIUM_HELMET)) .addCriterion("has_item0", criterion(MItems.TRITANIUM_HELMET))
.addCriterion("has_item1", criterion(MItems.TRITANIUM_CHESTPLATE)) .addCriterion("has_item1", criterion(MItems.TRITANIUM_CHESTPLATE))
.addCriterion("has_item2", criterion(MItems.TRITANIUM_PANTS)) .addCriterion("has_item2", criterion(MItems.TRITANIUM_PANTS))
.addCriterion("has_item3", criterion(MItems.TRITANIUM_BOOTS)) .addCriterion("has_item3", criterion(MItems.TRITANIUM_BOOTS))
.save(serializer, modLocation("regular/armor")) .save(serializer, modLocation("regular/armor"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(ingot) .parent(ingot)
@ -306,12 +303,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Создайте простую тритановую броню из слитков, просто и эффективно") russian("Создайте простую тритановую броню из слитков, просто и эффективно")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.addCriterion("has_item0", criterion(MItems.SIMPLE_TRITANIUM_HELMET)) .addCriterion("has_item0", criterion(MItems.SIMPLE_TRITANIUM_HELMET))
.addCriterion("has_item1", criterion(MItems.SIMPLE_TRITANIUM_CHESTPLATE)) .addCriterion("has_item1", criterion(MItems.SIMPLE_TRITANIUM_CHESTPLATE))
.addCriterion("has_item2", criterion(MItems.SIMPLE_TRITANIUM_PANTS)) .addCriterion("has_item2", criterion(MItems.SIMPLE_TRITANIUM_PANTS))
.addCriterion("has_item3", criterion(MItems.SIMPLE_TRITANIUM_BOOTS)) .addCriterion("has_item3", criterion(MItems.SIMPLE_TRITANIUM_BOOTS))
.save(serializer, modLocation("regular/simple_armor")) .save(serializer, modLocation("regular/simple_armor"), existingFileHelper)
val glass = AdvancementBuilder() val glass = AdvancementBuilder()
.parent(plate) .parent(plate)
@ -324,19 +321,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("В инструкции указано что оно должно быть пуленепробиваемо.") russian("В инструкции указано что оно должно быть пуленепробиваемо.")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.also { advancement -> .also { advancement ->
MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/industrial_glass")) .save(serializer, modLocation("regular/industrial_glass"), existingFileHelper)
CraftEntry(
MItems.FLUID_TANK, "Liquid Packaging",
russianName = "Упаковка для жидкостей").make(serializer, glass, translation)
CraftEntry(
MItems.FLUID_CAPSULE, "Liquid Canning",
russianName = "Банка для жидкостей").make(serializer, glass, translation)
AdvancementBuilder() AdvancementBuilder()
.parent(glass) .parent(glass)
@ -348,13 +337,13 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("industrial_glass2.desc", "Paint Industrial Glass all possible colors") { description = translation.add("industrial_glass2.desc", "Paint Industrial Glass all possible colors") {
russian("Покрасьте промышленное стекло во все возможные цвета") russian("Покрасьте промышленное стекло во все возможные цвета")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.requirements(Strategy.AND) .requirements(RequirementsStrategy.AND)
.also { advancement -> .also { advancement ->
MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/industrial_glass2")) .save(serializer, modLocation("regular/industrial_glass2"), existingFileHelper)
val cargoCrate = AdvancementBuilder() val cargoCrate = AdvancementBuilder()
.parent(plate) .parent(plate)
@ -367,11 +356,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Грузовые ящики, будто двойные сундуки, но одинарные.") russian("Грузовые ящики, будто двойные сундуки, но одинарные.")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.also { advancement -> .also { advancement ->
MRegistry.CARGO_CRATES.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.CARGO_CRATES.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/cargo_crate")) .save(serializer, modLocation("regular/cargo_crate"), existingFileHelper)
val cargoCrateInMinecart = AdvancementBuilder() val cargoCrateInMinecart = AdvancementBuilder()
.parent(cargoCrate) .parent(cargoCrate)
@ -384,11 +373,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Сбросьте грузовой ящик в вагонетку и посмотрите, что получится") russian("Сбросьте грузовой ящик в вагонетку и посмотрите, что получится")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.also { advancement -> .also { advancement ->
MItems.CARGO_CRATE_MINECARTS.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MItems.CARGO_CRATE_MINECARTS.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/cargo_crate_minecart")) .save(serializer, modLocation("regular/cargo_crate_minecart"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(cargoCrateInMinecart) .parent(cargoCrateInMinecart)
@ -400,13 +389,13 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("cargo_crate_minecart2.desc", "Have all color variants of Minecarts with Cargo Crates") { description = translation.add("cargo_crate_minecart2.desc", "Have all color variants of Minecarts with Cargo Crates") {
russian("Создайте все варианты покрасок вагонеток с грузовыми Ящиками") russian("Создайте все варианты покрасок вагонеток с грузовыми Ящиками")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.requirements(Strategy.AND) .requirements(RequirementsStrategy.AND)
.also { advancement -> .also { advancement ->
MItems.CARGO_CRATE_MINECARTS.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MItems.CARGO_CRATE_MINECARTS.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/cargo_crate_minecart2")) .save(serializer, modLocation("regular/cargo_crate_minecart2"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(cargoCrate) .parent(cargoCrate)
@ -418,16 +407,16 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("cargo_crate2.desc", "Craft all color variants of Cargo Crates") { description = translation.add("cargo_crate2.desc", "Craft all color variants of Cargo Crates") {
russian("Покрасьте грузовые ящики во все возможные цвета") russian("Покрасьте грузовые ящики во все возможные цвета")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.requirements(Strategy.AND) .requirements(RequirementsStrategy.AND)
.also { advancement -> .also { advancement ->
MRegistry.CARGO_CRATES.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.CARGO_CRATES.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/cargo_crate2")) .save(serializer, modLocation("regular/cargo_crate2"), existingFileHelper)
val tritaniumBlock = AdvancementBuilder() val tritaniumBlock = AdvancementBuilder()
.parent(ingot) .parent(plate)
.display( .display(
itemStack = ItemStack(MRegistry.TRITANIUM_BLOCK.item), itemStack = ItemStack(MRegistry.TRITANIUM_BLOCK.item),
title = translation.add("tritanium_block", "Cold, Impregnable Wall") { title = translation.add("tritanium_block", "Cold, Impregnable Wall") {
@ -437,21 +426,21 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Покройте булыжник в тритане, дешёвый, но невероятно прочный материал") russian("Покройте булыжник в тритане, дешёвый, но невероятно прочный материал")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.also { advancement -> .also { advancement ->
MRegistry.TRITANIUM_BLOCK.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_BLOCK.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MRegistry.TRITANIUM_STAIRS.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_STAIRS.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MItems.TRITANIUM_STRIPED_BLOCK.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MItems.TRITANIUM_STRIPED_BLOCK.also { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MItems.TRITANIUM_STRIPED_STAIRS.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MItems.TRITANIUM_STRIPED_STAIRS.also { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/tritanium_block")) .save(serializer, modLocation("regular/tritanium_block"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(tritaniumBlock) .parent(tritaniumBlock)
.display( .display(
itemStack = ItemStack(MItems.TRITANIUM_STRIPED_BLOCK[DyeColor.YELLOW]!!), itemStack = ItemStack(MItems.TRITANIUM_STRIPED_BLOCK),
title = translation.add("striped_tritanium_block", "Old Fashion Color Touch") { title = translation.add("striped_tritanium_block", "Old Fashion Color Touch") {
russian("Старомодная цветовая отделка") russian("Старомодная цветовая отделка")
}, },
@ -459,12 +448,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Бледно синяя покраска с жёлтой полоской, я готов поспорить вы знаете чей это дизайн") russian("Бледно синяя покраска с жёлтой полоской, я готов поспорить вы знаете чей это дизайн")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.addCriterion("has_item", criterion(MItems.TRITANIUM_STRIPED_BLOCK[DyeColor.YELLOW]!!)) .addCriterion("has_item", criterion(MItems.TRITANIUM_STRIPED_BLOCK))
.addCriterion("has_item1", criterion(MItems.TRITANIUM_STRIPED_STAIRS[DyeColor.YELLOW]!!)) .addCriterion("has_item1", criterion(MItems.TRITANIUM_STRIPED_STAIRS))
.addCriterion("has_item2", criterion(MItems.TRITANIUM_STRIPED_SLAB[DyeColor.YELLOW]!!)) .addCriterion("has_item2", criterion(MItems.TRITANIUM_STRIPED_SLAB))
.addCriterion("has_item3", criterion(MItems.TRITANIUM_STRIPED_WALL[DyeColor.YELLOW]!!)) .addCriterion("has_item3", criterion(MItems.TRITANIUM_STRIPED_WALL))
.save(serializer, modLocation("regular/striped_tritanium_block")) .save(serializer, modLocation("regular/striped_tritanium_block"), existingFileHelper)
val colorTritaniumBlock = AdvancementBuilder() val colorTritaniumBlock = AdvancementBuilder()
.parent(tritaniumBlock) .parent(tritaniumBlock)
@ -477,16 +466,16 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Покрасьте тритановый блок для придания ему сказочных оттенков") russian("Покрасьте тритановый блок для придания ему сказочных оттенков")
} }
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.also { advancement -> .also { advancement ->
MRegistry.TRITANIUM_BLOCK.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_BLOCK.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MRegistry.TRITANIUM_STAIRS.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_STAIRS.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MItems.TRITANIUM_STRIPED_BLOCK.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MItems.TRITANIUM_STRIPED_BLOCK.also { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MItems.TRITANIUM_STRIPED_STAIRS.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MItems.TRITANIUM_STRIPED_STAIRS.also { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/tritanium_block2")) .save(serializer, modLocation("regular/tritanium_block2"), existingFileHelper)
val colorfulTritaniumBlock = AdvancementBuilder() val colorfulTritaniumBlock = AdvancementBuilder()
.parent(colorTritaniumBlock) .parent(colorTritaniumBlock)
@ -498,14 +487,14 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("tritanium_block3.desc", "Craft all color variants of Tritanium Blocks") { description = translation.add("tritanium_block3.desc", "Craft all color variants of Tritanium Blocks") {
russian("Создайте все варианты покрасок тритановых Блоков") russian("Создайте все варианты покрасок тритановых Блоков")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.rewards(advancementLoot("tritanium_block3").addExperience(100)) .rewards(AdvancementRewards.Builder.loot(modLocation("tritanium_block3")).addExperience(100))
.requirements(Strategy.AND) .requirements(RequirementsStrategy.AND)
.also { advancement -> .also { advancement ->
MRegistry.TRITANIUM_BLOCK.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_BLOCK.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/tritanium_block3")) .save(serializer, modLocation("regular/tritanium_block3"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(colorfulTritaniumBlock) .parent(colorfulTritaniumBlock)
@ -517,16 +506,16 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("tritanium_block4.desc", "Craft ALL color variants of Tritanium Blocks including striped ones") { description = translation.add("tritanium_block4.desc", "Craft ALL color variants of Tritanium Blocks including striped ones") {
russian("Создайте АБСОЛЮТНО ВСЕ варианты покрасок тритановых блоков, включая с полосками") russian("Создайте АБСОЛЮТНО ВСЕ варианты покрасок тритановых блоков, включая с полосками")
}, },
frameType = AdvancementType.CHALLENGE frameType = FrameType.CHALLENGE
) )
.rewards(advancementLoot("tritanium_block4").addExperience(400)) .rewards(AdvancementRewards.Builder.loot(modLocation("tritanium_block4")).addExperience(400))
.requirements(Strategy.AND) .requirements(RequirementsStrategy.AND)
.also { advancement -> .also { advancement ->
MRegistry.TRITANIUM_BLOCK.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_BLOCK.items.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
MItems.TRITANIUM_STRIPED_BLOCK.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) } MItems.TRITANIUM_STRIPED_BLOCK.also { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
} }
.save(serializer, modLocation("regular/tritanium_block4")) .save(serializer, modLocation("regular/tritanium_block4"), existingFileHelper)
val pill = AdvancementBuilder() val pill = AdvancementBuilder()
.parent(root) .parent(root)
@ -539,12 +528,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Найдите одну из этих ваших мистических пилюль") russian("Найдите одну из этих ваших мистических пилюль")
}, },
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.also { .addCriterion("pill1", criterion(MItems.PILL_ANDROID))
for ((i, item) in MItems.PILLS.withIndex()) .addCriterion("pill2", criterion(MItems.PILL_HEAL))
it.addCriterion("pill$i", criterion(item)) .addCriterion("pill3", criterion(MItems.PILL_HUMANE))
} .addCriterion("pill4", criterion(MItems.PILL_OBLIVION))
.save(serializer, modLocation("regular/pill")) .save(serializer, modLocation("regular/pill"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(pill) .parent(pill)
@ -556,18 +545,18 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("all_pills.desc", "Find all possible pill types") { description = translation.add("all_pills.desc", "Find all possible pill types") {
russian("Найдите всевозможные варианты пилюль") russian("Найдите всевозможные варианты пилюль")
}, },
frameType = AdvancementType.CHALLENGE, frameType = FrameType.CHALLENGE,
hidden = true hidden = true
) )
.rewards(AdvancementRewards.Builder.experience(200)) .rewards(AdvancementRewards.Builder.experience(200))
.requirements(Strategy.AND) .requirements(RequirementsStrategy.AND)
.also { .addCriterion("pill1", criterion(MItems.PILL_ANDROID))
for ((i, item) in MItems.PILLS.withIndex()) .addCriterion("pill2", criterion(MItems.PILL_HEAL))
it.addCriterion("pill$i", criterion(item)) .addCriterion("pill3", criterion(MItems.PILL_HUMANE))
} .addCriterion("pill4", criterion(MItems.PILL_OBLIVION))
.save(serializer, modLocation("regular/all_pills")) .save(serializer, modLocation("regular/all_pills"), existingFileHelper)
val essenceCapsule = AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
.display( .display(
itemStack = ItemStack(MItems.ESSENCE_CAPSULE), itemStack = ItemStack(MItems.ESSENCE_CAPSULE),
@ -578,10 +567,10 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Верните капсулу эссенции. Воспоминания...") russian("Верните капсулу эссенции. Воспоминания...")
}, },
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.addCriterion("essence1", criterion(MItems.ESSENCE_CAPSULE)) .addCriterion("essence1", criterion(MItems.ESSENCE_CAPSULE))
.addCriterion("essence2", criterion(MItems.ESSENCE_DRIVE)) .addCriterion("essence2", criterion(MItems.ESSENCE_DRIVE))
.save(serializer, modLocation("regular/essence_capsule")) .save(serializer, modLocation("regular/essence_capsule"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -594,10 +583,6 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Пригвоздите что-либо (или кого-либо)") russian("Пригвоздите что-либо (или кого-либо)")
} }
) )
.addCriterion("damage", NailedEntityTrigger.Instance().criterion()) .addCriterion("damage", NailedEntityTrigger.Instance())
.save(serializer, modLocation("regular/explosive_hammer")) .save(serializer, modLocation("regular/explosive_hammer"), existingFileHelper)
CraftEntry(
MItems.ESSENCE_STORAGE.values, "Did not Forget to Remember",
russianName = "Не забыл запомнить").make(serializer, essenceCapsule, translation)
} }

View File

@ -1,38 +1,38 @@
package ru.dbotthepony.mc.otm.datagen.advancements package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.AdvancementHolder import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementRequirements.Strategy
import net.minecraft.advancements.AdvancementRewards import net.minecraft.advancements.AdvancementRewards
import net.minecraft.advancements.AdvancementType import net.minecraft.advancements.FrameType
import net.minecraft.advancements.RequirementsStrategy
import net.minecraft.advancements.critereon.EntityPredicate import net.minecraft.advancements.critereon.EntityPredicate
import net.minecraft.advancements.critereon.ItemPredicate import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.advancements.critereon.MinMaxBounds.Doubles import net.minecraft.advancements.critereon.MinMaxBounds.Doubles
import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraftforge.common.data.ExistingFileHelper
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures import ru.dbotthepony.mc.otm.registry.AndroidFeatures
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.server.triggers.AndroidBatteryTrigger import ru.dbotthepony.mc.otm.triggers.AndroidBatteryTrigger
import ru.dbotthepony.mc.otm.server.triggers.AndroidResearchTrigger import ru.dbotthepony.mc.otm.triggers.AndroidResearchTrigger
import ru.dbotthepony.mc.otm.server.triggers.AndroidTravelUnderwater import ru.dbotthepony.mc.otm.triggers.AndroidTravelUnderwater
import ru.dbotthepony.mc.otm.server.triggers.BecomeAndroidDeathTrigger import ru.dbotthepony.mc.otm.triggers.BecomeAndroidDeathTrigger
import ru.dbotthepony.mc.otm.server.triggers.BecomeAndroidSleepTrigger import ru.dbotthepony.mc.otm.triggers.BecomeAndroidSleepTrigger
import ru.dbotthepony.mc.otm.server.triggers.BecomeAndroidTrigger import ru.dbotthepony.mc.otm.triggers.BecomeAndroidTrigger
import ru.dbotthepony.mc.otm.server.triggers.BecomeHumaneTrigger import ru.dbotthepony.mc.otm.triggers.BecomeHumaneTrigger
import ru.dbotthepony.mc.otm.server.triggers.EnderTeleporterFallDeathTrigger import ru.dbotthepony.mc.otm.triggers.EnderTeleporterFallDeathTrigger
import ru.dbotthepony.mc.otm.server.triggers.FallDampenersSaveTrigger import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger
import ru.dbotthepony.mc.otm.server.triggers.KillAsAndroidTrigger import ru.dbotthepony.mc.otm.triggers.KillAsAndroidTrigger
import ru.dbotthepony.mc.otm.server.triggers.NanobotsArmorTrigger import ru.dbotthepony.mc.otm.triggers.NanobotsArmorTrigger
import ru.dbotthepony.mc.otm.server.triggers.ShockwaveDamageMobTrigger import ru.dbotthepony.mc.otm.triggers.ShockwaveDamageMobTrigger
import ru.dbotthepony.mc.otm.server.triggers.ShockwaveTrigger import ru.dbotthepony.mc.otm.triggers.ShockwaveTrigger
import java.util.*
import java.util.function.Consumer import java.util.function.Consumer
fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLanguageProvider) { fun addAndroidAdvancements(serializer: Consumer<Advancement>, existingFileHelper: ExistingFileHelper, lang: MatteryLanguageProvider) {
val translation = lang.MultiBuilder("otm.advancements.android") val translation = lang.MultiBuilder("otm.advancements.android")
val root = AdvancementBuilder() val root = AdvancementBuilder()
@ -48,8 +48,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
announceChat = false, announceChat = false,
background = modLocation("textures/block/decorative/metal_beam_top.png") background = modLocation("textures/block/decorative/metal_beam_top.png")
) )
.addCriterion("became_android", BecomeAndroidTrigger.criterion) .addCriterion("became_android", BecomeAndroidTrigger.Instance)
.save(serializer, modLocation("android/root")) .save(serializer, modLocation("android/root"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -62,10 +62,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Используйте модуль нулевой точки как внутренний источник питания. Теперь только вечность будет вашим злейшим врагом") russian("Используйте модуль нулевой точки как внутренний источник питания. Теперь только вечность будет вашим злейшим врагом")
}, },
hidden = true, hidden = true,
frameType = AdvancementType.CHALLENGE frameType = FrameType.CHALLENGE
) )
.addCriterion("item", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.ZPM_BATTERY).build()).criterion()) .addCriterion("item", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.ZPM_BATTERY).build()))
.save(serializer, modLocation("android/zpm")) .save(serializer, modLocation("android/zpm"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -78,12 +78,12 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Используйте Квантовый Аккумулятор как внутренний источник питания, можно даже подключить другой конец к Реактору Распада") russian("Используйте Квантовый Аккумулятор как внутренний источник питания, можно даже подключить другой конец к Реактору Распада")
}, },
hidden = true, hidden = true,
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.requirements(Strategy.OR) .requirements(RequirementsStrategy.OR)
.addCriterion("item0", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_BATTERY).build()).criterion()) .addCriterion("item0", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_BATTERY).build()))
.addCriterion("item1", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_CAPACITOR).build()).criterion()) .addCriterion("item1", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_CAPACITOR).build()))
.save(serializer, modLocation("android/quantum_battery")) .save(serializer, modLocation("android/quantum_battery"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -97,8 +97,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
}, },
hidden = true, hidden = true,
) )
.addCriterion("became_android", BecomeAndroidSleepTrigger.criterion) .addCriterion("became_android", BecomeAndroidSleepTrigger.Instance)
.save(serializer, modLocation("android/become_thru_sleep")) .save(serializer, modLocation("android/become_thru_sleep"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -108,12 +108,12 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Изготовленный по старинке") russian("Изготовленный по старинке")
}, },
description = translation.add("death.desc", "In event of death, become an Android; Veteran's favorite") { description = translation.add("death.desc", "In event of death, become an Android; Veteran's favorite") {
russian("Станьте андроидом, будучи умерев; Ветераны оценят") russian("Будучи умерев, станьте андроидом; Ветераны оценят")
}, },
hidden = true, hidden = true,
) )
.addCriterion("became_android", BecomeAndroidDeathTrigger.criterion) .addCriterion("became_android", BecomeAndroidDeathTrigger.Instance)
.save(serializer, modLocation("android/become_thru_death")) .save(serializer, modLocation("android/become_thru_death"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -126,29 +126,43 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Вновь обретите плоть после своей жизни как набор гаек и болтов, но вот чего-то всё равно не хватает, что было при вас с самого начала...") russian("Вновь обретите плоть после своей жизни как набор гаек и болтов, но вот чего-то всё равно не хватает, что было при вас с самого начала...")
}, },
hidden = true, hidden = true,
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.addCriterion("become_humane", BecomeHumaneTrigger.criterion) .addCriterion("become_humane", BecomeHumaneTrigger.Instance)
.save(serializer, modLocation("android/become_humane")) .save(serializer, modLocation("android/become_humane"), existingFileHelper)
val attractor = AdvancementBuilder() val attractor = AdvancementBuilder()
.parent(root) .parent(root)
.display( .display(
itemStack = ItemStack(MItems.PHANTOM_ATTRACTOR), itemStack = ItemStack(MItems.PHANTOM_ATTRACTOR),
title = translation.add("phantom_attractor", "Eversleeping Decoy") { title = translation.add("phantom_attractor", "Eversleeping Decoy") {
russian("Фантоматичная приманка") russian("Вечноспящий декой")
}, },
description = translation.add("phantom_attractor.desc", "Put together a Phantom Attractor, to be able to fight Phantoms as Android again") { description = translation.add("phantom_attractor.desc", "Put together a Phantom Attractor, to be able to fight Phantoms as Android again") {
russian("Создайте приманщик фантомов, для привлечения фантомов вновь, будучи андроидом") russian("Создайте приманщик фантомов, для привлечения фантомов вновь, будучи андроидом")
}, },
) )
.addCriterion("has_item", criterion(MItems.PHANTOM_ATTRACTOR)) .addCriterion("has_item", criterion(MItems.PHANTOM_ATTRACTOR))
.save(serializer, modLocation("regular/phantom_attractor")) .save(serializer, modLocation("regular/phantom_attractor"), existingFileHelper)
AdvancementBuilder()
.parent(attractor)
.display(
itemStack = ItemStack(MItems.PHANTOM_ATTRACTOR),
title = translation.add("phantom_attractor_research", "Deception of Phantoms") {
russian("Обман фантомов")
},
description = translation.add("phantom_attractor_research.desc", "Research into how to attract Phantoms the same way as the ones who need to sleep") {
russian("Исследуйте привлечение фантомов, чтоб привлекать их так же, как те, кому нужно спать")
},
)
.addCriterion("researched", AndroidResearchTrigger.Instance(modLocation(MNames.PHANTOM_ATTRACTOR)))
.save(serializer, modLocation("regular/phantom_attractor_research"), existingFileHelper)
val researchAnything = AdvancementBuilder() val researchAnything = AdvancementBuilder()
.parent(root) .parent(root)
.display( .display(
itemStack = ItemStack(MItems.ANDROID_STATION[null]!!), itemStack = ItemStack(MItems.ANDROID_STATION),
title = translation.add("research_anything", "New Trick") { title = translation.add("research_anything", "New Trick") {
russian("Новый фокус") russian("Новый фокус")
}, },
@ -156,8 +170,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте что либо за андроида") russian("Исследуйте что либо за андроида")
}, },
) )
.addCriterion("research_anything", AndroidResearchTrigger.Instance(Optional.empty(), Optional.empty()).criterion()) .addCriterion("research_anything", AndroidResearchTrigger.Instance(null))
.save(serializer, modLocation("android/research_anything")) .save(serializer, modLocation("android/research_anything"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(researchAnything) .parent(researchAnything)
@ -170,8 +184,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте воздушные мешки, дабы быть вновь поплавком в воде") russian("Исследуйте воздушные мешки, дабы быть вновь поплавком в воде")
}, },
) )
.addCriterion("air_bags", AndroidResearchTrigger.Instance(modLocation(MNames.AIR_BAGS)).criterion()) .addCriterion("air_bags", AndroidResearchTrigger.Instance(modLocation(MNames.AIR_BAGS)))
.save(serializer, modLocation("android/research_air_bags")) .save(serializer, modLocation("android/research_air_bags"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(researchAnything) .parent(researchAnything)
@ -184,8 +198,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте ночное зрение за андроида, дабы видеть во темноте") russian("Исследуйте ночное зрение за андроида, дабы видеть во темноте")
}, },
) )
.addCriterion("night_vision", AndroidResearchTrigger.Instance(modLocation(MNames.NIGHT_VISION)).criterion()) .addCriterion("night_vision", AndroidResearchTrigger.Instance(modLocation(MNames.NIGHT_VISION)))
.save(serializer, modLocation("android/research_night_vision")) .save(serializer, modLocation("android/research_night_vision"), existingFileHelper)
val nanobots = AdvancementBuilder() val nanobots = AdvancementBuilder()
.parent(researchAnything) .parent(researchAnything)
@ -199,8 +213,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
}, },
hidden = true hidden = true
) )
.addCriterion("nanobots", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS)).criterion()) .addCriterion("nanobots", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS)))
.save(serializer, modLocation("android/research_nanobots")) .save(serializer, modLocation("android/research_nanobots"), existingFileHelper)
val shielding = AdvancementBuilder() val shielding = AdvancementBuilder()
.parent(nanobots) .parent(nanobots)
@ -213,10 +227,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Дайте наноботам поглотить 5 сердец урона, не отключившись насовсем") russian("Дайте наноботам поглотить 5 сердец урона, не отключившись насовсем")
}, },
hidden = true, hidden = true,
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(10.0)).criterion()) .addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(10.0)))
.save(serializer, modLocation("android/nanobots_armor_deflect")) .save(serializer, modLocation("android/nanobots_armor_deflect"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(shielding) .parent(shielding)
@ -229,10 +243,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Дайте наноботам поглотить 10 сердец урона, не отключившись насовсем") russian("Дайте наноботам поглотить 10 сердец урона, не отключившись насовсем")
}, },
hidden = true, hidden = true,
frameType = AdvancementType.CHALLENGE frameType = FrameType.CHALLENGE
) )
.addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(20.0)).criterion()) .addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(20.0)))
.save(serializer, modLocation("android/nanobots_armor_deflect2")) .save(serializer, modLocation("android/nanobots_armor_deflect2"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(researchAnything) .parent(researchAnything)
@ -244,10 +258,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("fall_dampeners_save.desc", "Survive fall that would have otherwise be fatal without Fall Dampeners") { description = translation.add("fall_dampeners_save.desc", "Survive fall that would have otherwise be fatal without Fall Dampeners") {
russian("Выживите после падения, которое было бы фатальным без поглотителей инерции") russian("Выживите после падения, которое было бы фатальным без поглотителей инерции")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.addCriterion("saved", FallDampenersSaveTrigger.criterion) .addCriterion("saved", FallDampenersSaveTrigger.Instance)
.save(serializer, modLocation("android/fall_dampeners_save")) .save(serializer, modLocation("android/fall_dampeners_save"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(researchAnything) .parent(researchAnything)
@ -259,11 +273,11 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("ender_teleport_fall_death.desc", "Fall to your demise moments after Teleporting as Android") { description = translation.add("ender_teleport_fall_death.desc", "Fall to your demise moments after Teleporting as Android") {
russian("Разбейтесь насмерть через мгновения после телепортации за андроида") russian("Разбейтесь насмерть через мгновения после телепортации за андроида")
}, },
frameType = AdvancementType.GOAL, frameType = FrameType.GOAL,
hidden = true hidden = true
) )
.addCriterion("death", EnderTeleporterFallDeathTrigger.criterion) .addCriterion("death", EnderTeleporterFallDeathTrigger.Instance)
.save(serializer, modLocation("android/ender_teleport_fall_death")) .save(serializer, modLocation("android/ender_teleport_fall_death"), existingFileHelper)
val regen = AdvancementBuilder() val regen = AdvancementBuilder()
.parent(nanobots) .parent(nanobots)
@ -276,8 +290,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте регенерацию наноботов за андроида") russian("Исследуйте регенерацию наноботов за андроида")
}, },
) )
.addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)).criterion()) .addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)))
.save(serializer, modLocation("android/regen")) .save(serializer, modLocation("android/regen"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(regen) .parent(regen)
@ -289,35 +303,35 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("regen_all.desc", "Max out Nanobots Regeneration research") { description = translation.add("regen_all.desc", "Max out Nanobots Regeneration research") {
russian("Полностью исследуйте регенерацию наноботов за андроида") russian("Полностью исследуйте регенерацию наноботов за андроида")
}, },
frameType = AdvancementType.GOAL, frameType = FrameType.GOAL,
) )
.addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)).criterion()) .addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)))
.addCriterion("regen1", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_2)).criterion()) .addCriterion("regen1", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_2)))
.addCriterion("regen2", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_3)).criterion()) .addCriterion("regen2", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_3)))
.addCriterion("regen3", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_4)).criterion()) .addCriterion("regen3", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_4)))
.save(serializer, modLocation("android/regen_all")) .save(serializer, modLocation("android/regen_all"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(researchAnything) .parent(researchAnything)
.display( .display(
itemStack = ItemStack(MItems.ANDROID_STATION[null]!!), itemStack = ItemStack(MItems.ANDROID_STATION),
title = translation.add("research_all", "Mecha-Agnomination") { title = translation.add("research_all", "Mecha-Agnomination") {
russian("Меха-зумие") russian("Меха-зумие")
}, },
description = translation.add("research_all.desc", "Research everything as Android (that don't block or get blocked by any other research)") { description = translation.add("research_all.desc", "Research everything as Android (that don't block or get blocked by any other research)") {
russian("Исследуйте все технологии за андроида (которые не блокируют и не блокируются другими технологиями)") russian("Исследуйте все технологии за андроида (которые не блокируют и не блокируются другими технологиями)")
}, },
frameType = AdvancementType.CHALLENGE frameType = FrameType.CHALLENGE
) )
.rewards(AdvancementRewards.Builder.experience(400).addLootTable(modLocation("research_all_android"))) .rewards(AdvancementRewards.Builder.experience(400).addLootTable(modLocation("research_all_android")))
.also { advancement -> .also { advancement ->
DataGen.researchProvider.generatedView.stream() DataGen.researchProvider.generatedView.stream()
.filter { it.allBlockedBy.isEmpty() && it.allBlocking.isEmpty() } .filter { it.allBlockedBy.isEmpty() && it.allBlocking.isEmpty() }
.forEach { .forEach {
advancement.addCriterion(it.id.toString(), AndroidResearchTrigger.Instance(it).criterion()) advancement.addCriterion(it.id.toString(), AndroidResearchTrigger.Instance(it))
} }
} }
.save(serializer, modLocation("android/research_everything")) .save(serializer, modLocation("android/research_everything"), existingFileHelper)
val shockwave = AdvancementBuilder() val shockwave = AdvancementBuilder()
.parent(researchAnything) .parent(researchAnything)
@ -330,8 +344,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Вызовите ударную волну при приземлении") russian("Вызовите ударную волну при приземлении")
}, },
) )
.addCriterion("shockwave", ShockwaveTrigger.criterion) .addCriterion("shockwave", ShockwaveTrigger.Instance)
.save(serializer, modLocation("android/shockwave")) .save(serializer, modLocation("android/shockwave"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(shockwave) .parent(shockwave)
@ -343,10 +357,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("shockwave_warden.desc", "Hurt Warden using Shockwave ability") { description = translation.add("shockwave_warden.desc", "Hurt Warden using Shockwave ability") {
russian("Нанесите хранителю урон используя ударную волну") russian("Нанесите хранителю урон используя ударную волну")
}, },
frameType = AdvancementType.GOAL frameType = FrameType.GOAL
) )
.addCriterion("shockwave_warden", ShockwaveDamageMobTrigger.Instance(Optional.of(EntityPredicate.Builder.entity().of(EntityType.WARDEN).build().wrap())).criterion()) .addCriterion("shockwave_warden", ShockwaveDamageMobTrigger.Instance(EntityPredicate.Builder.entity().of(EntityType.WARDEN).build().wrap()))
.save(serializer, modLocation("android/shockwave_warden")) .save(serializer, modLocation("android/shockwave_warden"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -358,13 +372,13 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("wither.desc", "Defeat The Wither as Android. The Wither was surely confused over kind of thing you are") { description = translation.add("wither.desc", "Defeat The Wither as Android. The Wither was surely confused over kind of thing you are") {
russian("Победите Иссушителя будучи андроидом. Наверняка Иссушитель был ошеломлён таким раскладом дел") russian("Победите Иссушителя будучи андроидом. Наверняка Иссушитель был ошеломлён таким раскладом дел")
}, },
frameType = AdvancementType.GOAL, frameType = FrameType.GOAL,
hidden = true hidden = true
) )
.addCriterion("kill_wither", KillAsAndroidTrigger.Instance( .addCriterion("kill_wither", KillAsAndroidTrigger.Instance(
predicate = Optional.of(EntityPredicate.Builder.entity().of(EntityType.WITHER).build().wrap()), predicate = EntityPredicate.Builder.entity().of(EntityType.WITHER).build().wrap(),
).criterion()) ))
.save(serializer, modLocation("android/wither")) .save(serializer, modLocation("android/wither"), existingFileHelper)
val underwater = AdvancementBuilder() val underwater = AdvancementBuilder()
.parent(root) .parent(root)
@ -376,11 +390,11 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("travel_underwater.desc", "Travel at least 200 meters underwater as Android without Air Bags research. This reminds us of someone...") { description = translation.add("travel_underwater.desc", "Travel at least 200 meters underwater as Android without Air Bags research. This reminds us of someone...") {
russian("Преодолейте как минимум 200 метров под водой будучи андроидом без исследования воздушных мешков. Кого-то это нам напоминает...") russian("Преодолейте как минимум 200 метров под водой будучи андроидом без исследования воздушных мешков. Кого-то это нам напоминает...")
}, },
frameType = AdvancementType.GOAL, frameType = FrameType.GOAL,
hidden = true hidden = true
) )
.addCriterion("travel", AndroidTravelUnderwater.Instance(200.0).criterion()) .addCriterion("travel", AndroidTravelUnderwater.Instance(200.0))
.save(serializer, modLocation("android/underwater")) .save(serializer, modLocation("android/underwater"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(underwater) .parent(underwater)
@ -392,11 +406,11 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("travel_underwater2.desc", "Travel at least 1046 meters underwater as Android without Air Bags research, like someone else did so") { description = translation.add("travel_underwater2.desc", "Travel at least 1046 meters underwater as Android without Air Bags research, like someone else did so") {
russian("Преодолейте как минимум 1046 метров под водой будучи андроидом без исследования воздушных мешков, прям как тот, кто так однажды так и сделал") russian("Преодолейте как минимум 1046 метров под водой будучи андроидом без исследования воздушных мешков, прям как тот, кто так однажды так и сделал")
}, },
frameType = AdvancementType.CHALLENGE, frameType = FrameType.CHALLENGE,
hidden = true hidden = true
) )
.addCriterion("travel", AndroidTravelUnderwater.Instance(1046.0).criterion()) .addCriterion("travel", AndroidTravelUnderwater.Instance(1046.0))
.save(serializer, modLocation("android/underwater2")) .save(serializer, modLocation("android/underwater2"), existingFileHelper)
AdvancementBuilder() AdvancementBuilder()
.parent(root) .parent(root)
@ -408,12 +422,12 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("elder_guardian.desc", "Slay Elder Guardian as Android without Air Bags researched") { description = translation.add("elder_guardian.desc", "Slay Elder Guardian as Android without Air Bags researched") {
russian("Победите Древнего стража будучи андроидом без исследования воздушных мешков") russian("Победите Древнего стража будучи андроидом без исследования воздушных мешков")
}, },
frameType = AdvancementType.CHALLENGE, frameType = FrameType.CHALLENGE,
hidden = true hidden = true
) )
.addCriterion("kill_elder_guardian", KillAsAndroidTrigger.Instance( .addCriterion("kill_elder_guardian", KillAsAndroidTrigger.Instance(
predicate = Optional.of(EntityPredicate.Builder.entity().of(EntityType.ELDER_GUARDIAN).build().wrap()), predicate = EntityPredicate.Builder.entity().of(EntityType.ELDER_GUARDIAN).build().wrap(),
featurePredicate = KillAsAndroidTrigger.Not(KillAsAndroidTrigger.Has(AndroidFeatures.AIR_BAGS.registryName!!)) featurePredicate = KillAsAndroidTrigger.Not(KillAsAndroidTrigger.Has(AndroidFeatures.AIR_BAGS.registryName!!))
).criterion()) ))
.save(serializer, modLocation("android/elder_guardian")) .save(serializer, modLocation("android/elder_guardian"), existingFileHelper)
} }

View File

@ -1,263 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.AdvancementType
import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.server.triggers.ExopackBatterySlotTrigger
import ru.dbotthepony.mc.otm.server.triggers.ExopackGainedCraftingTrigger
import ru.dbotthepony.mc.otm.server.triggers.ExopackGainedEnderAccessTrigger
import ru.dbotthepony.mc.otm.server.triggers.ExopackGainedSmeltingTrigger
import ru.dbotthepony.mc.otm.server.triggers.ExopackObtainedTrigger
import ru.dbotthepony.mc.otm.server.triggers.ExopackSlotsExpandedTrigger
import java.util.function.Consumer
fun addExopackAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLanguageProvider, root: AdvancementHolder, zpm: AdvancementHolder) {
val translation = lang.MultiBuilder("otm.advancements.exopack")
AdvancementBuilder()
.parent(zpm)
.display(
hidden = true,
itemStack = ItemStack(MItems.ZPM_BATTERY),
title = translation.add("zpm_battery", "At Maximum Battery Capacity") {
russian("Достигнут максимальный заряд батареи")
},
description = translation.add("zpm_battery.desc", "Use Zero Point Module as power source in Exopack") {
russian("Используйте модуль нулевой точки как источник питания в Экзопаке")
},
frameType = AdvancementType.GOAL
)
.addCriterion("zpm_battery", ExopackBatterySlotTrigger.Instance(ItemPredicate.Builder.item().of(MItems.ZPM_BATTERY).build()).criterion())
.save(serializer, modLocation("exopack/zpm_battery"))
val obtained = AdvancementBuilder()
.parent(root)
.display(
itemStack = ItemStack(MItems.EXOPACK_PROBE),
title = translation.add("obtained", "One Dimension Bigger") {
russian("Больше на одно измерение")
},
description = translation.add("obtained.desc", "Obtain an Exopack, a mysterious, semi-present, light as a feather, stuff storage on your back") {
russian("Получите Экзопак, загадочное, полу-присутствующее, лёгкое как пёрышко, хранилище штуковин на вашей спине")
},
frameType = AdvancementType.GOAL
)
.addCriterion("obtained", ExopackObtainedTrigger.criterion)
.save(serializer, modLocation("exopack/obtained"))
AdvancementBuilder()
.parent(obtained)
.display(
itemStack = ItemStack(Items.CRAFTING_TABLE),
title = translation.add("crafting", "Crafting on Go") {
russian("Крафт по пути")
},
description = translation.add("crafting.desc", "Install Crafting Upgrade in your Exopack, allowing to craft 3x3 recipes") {
russian("Установите улучшение сетки крафта в ваш Экзопаке, который позволяет создавать предметы, требующие сетку крафта рабочего стола")
},
)
.addCriterion("crafting", ExopackGainedCraftingTrigger.criterion)
.save(serializer, modLocation("exopack/crafting"))
AdvancementBuilder()
.parent(obtained)
.display(
itemStack = ItemStack(Items.FURNACE),
title = translation.add("smelting", "Pocket Furnace") {
russian("Печь в кармане")
},
description = translation.add("smelting.desc", "Install Smelting Module in your Exopack, allowing to smelt items right inside your inventory") {
russian("Установите модуль переплавки в ваш Экзопак, позволяющий переплавлять предметы прямо у вас в инвентаре")
},
)
.addCriterion("smelting", ExopackGainedSmeltingTrigger.criterion)
.save(serializer, modLocation("exopack/smelting"))
AdvancementBuilder()
.parent(obtained)
.display(
itemStack = ItemStack(Items.ENDER_CHEST),
title = translation.add("ender_access", "Ender-ious Access") {
russian("Эендер-иумый Доступ")
},
description = translation.add("ender_access.desc", "Gain direct access to your Ender Chest out of your Exopack") {
russian("Получите прямой доступ к содержимому вашего сундука края прямо из Экзопака")
},
)
.addCriterion("ender_access", ExopackGainedEnderAccessTrigger.criterion)
.save(serializer, modLocation("ender_access/smelting"))
var size = AdvancementBuilder()
.parent(obtained)
.display(
itemStack = ItemStack(Items.CHEST),
title = translation.add("size0", "Closet Upgrade") {
russian("Обновление чуланчика")
},
description = translation.add("size0.desc", "Upgrade Exopack storage") {
russian("Улучшите размер инвентаря Экзопака")
},
)
.addCriterion("size0", ExopackSlotsExpandedTrigger.Instance(minTotal = 1).criterion())
.save(serializer, modLocation("exopack/size0"))
val size0 = size
size = AdvancementBuilder()
.parent(size)
.display(
itemStack = ItemStack(Items.CHEST),
title = translation.add("size1", "Double the Capacity") {
russian("Двойной объём")
},
description = translation.add("size1.desc", "Reach 27 slots in your Exopack storage") {
russian("Достигните 27 слотов хранилища Экзопака")
},
)
.addCriterion("size1", ExopackSlotsExpandedTrigger.Instance(minTotal = 27).criterion())
.save(serializer, modLocation("exopack/size1"))
size = AdvancementBuilder()
.parent(size)
.display(
itemStack = ItemStack(Items.CHEST),
hidden = true,
title = translation.add("size2", "Pack Rat") {
russian("Воришка")
},
description = translation.add("size2.desc", "Reach 54 slots in your Exopack storage") {
russian("Достигните 54 слотов хранилища Экзопака")
},
)
.addCriterion("size2", ExopackSlotsExpandedTrigger.Instance(minTotal = 54).criterion())
.save(serializer, modLocation("exopack/size2"))
size = AdvancementBuilder()
.parent(size)
.display(
itemStack = ItemStack(Items.CHEST),
hidden = true,
title = translation.add("size3", "Its Getting Big In Here") {
russian("Тут становится просторно")
},
description = translation.add("size3.desc", "Reach 108 slots in your Exopack storage") {
russian("Достигните 108 слотов хранилища Экзопака")
},
frameType = AdvancementType.GOAL
)
.addCriterion("size3", ExopackSlotsExpandedTrigger.Instance(minTotal = 108).criterion())
.save(serializer, modLocation("exopack/size3"))
size = AdvancementBuilder()
.parent(size)
.display(
itemStack = ItemStack(Items.ENDER_CHEST),
hidden = true,
title = translation.add("size4", "Warehousing Pioneer") {
russian("Пионер складских решений")
},
description = translation.add("size4.desc", "Reach 432 slots in your Exopack storage. You could fit a house in there") {
russian("Достигните 432 слотов хранилища Экзопака. Туда можно уже впихнуть целый дом")
},
frameType = AdvancementType.CHALLENGE
)
.addCriterion("size4", ExopackSlotsExpandedTrigger.Instance(minTotal = 432).criterion())
.save(serializer, modLocation("exopack/size4"))
AdvancementBuilder()
.parent(size)
.display(
itemStack = ItemStack(Items.ENDER_CHEST),
hidden = true,
title = translation.add("size5", "With Volume Like This...") {
russian("С таким объёмом...")
},
description = translation.add("size5.desc", "Reach 1728 slots in your Exopack storage. Why would you need to go any bigger?!") {
russian("Достигните 1728 слотов хранилища Экзопака. Куда вам столько?!")
},
frameType = AdvancementType.CHALLENGE
)
.addCriterion("size5", ExopackSlotsExpandedTrigger.Instance(minTotal = 1728).criterion())
.save(serializer, modLocation("exopack/size5"))
var once = AdvancementBuilder()
.parent(size0)
.display(
itemStack = ItemStack(Items.CHEST),
title = translation.add("once0", "One Module - One Row") {
russian("Один модуль - одна строка")
},
description = translation.add("once0.desc", "Upgrade your Exopack storage with 9 slots using one module") {
russian("Улучшите хранилище Экзопака модулем на 9 слотов")
},
)
.addCriterion("once0", ExopackSlotsExpandedTrigger.Instance(minGained = 9).criterion())
.save(serializer, modLocation("exopack/once0"))
once = AdvancementBuilder()
.parent(once)
.display(
itemStack = ItemStack(Items.CHEST),
title = translation.add("once1", "One Module - One Chest") {
russian("Один модуль - один сундук")
},
description = translation.add("once1.desc", "Upgrade your Exopack storage with 27 slots using one module") {
russian("Улучшите хранилище Экзопака модулем на 27 слотов")
},
)
.addCriterion("once1", ExopackSlotsExpandedTrigger.Instance(minGained = 27).criterion())
.save(serializer, modLocation("exopack/once1"))
once = AdvancementBuilder()
.parent(once)
.display(
itemStack = ItemStack(Items.CHEST),
hidden = true,
title = translation.add("once2", "One Module - Two Chests?") {
russian("Один модуль - два сундука?")
},
description = translation.add("once2.desc", "Upgrade your Exopack storage with 54 slots using one module") {
russian("Улучшите хранилище Экзопака модулем на 54 слотов")
},
frameType = AdvancementType.GOAL
)
.addCriterion("once2", ExopackSlotsExpandedTrigger.Instance(minGained = 54).criterion())
.save(serializer, modLocation("exopack/once2"))
once = AdvancementBuilder()
.parent(once)
.display(
itemStack = ItemStack(Items.ENDER_CHEST),
hidden = true,
title = translation.add("once3", "Storage Housing Construct") {
russian("Хранилище быстрого приготовления")
},
description = translation.add("once3.desc", "Upgrade your Exopack storage with 90 slots using one module") {
russian("Улучшите хранилище Экзопака модулем на 90 слотов")
},
frameType = AdvancementType.GOAL
)
.addCriterion("once3", ExopackSlotsExpandedTrigger.Instance(minGained = 90).criterion())
.save(serializer, modLocation("exopack/once3"))
AdvancementBuilder()
.parent(once)
.display(
itemStack = ItemStack(Items.ENDER_CHEST),
hidden = true,
title = translation.add("once4", "Non-Euclidean Wardrobe") {
russian("Неевклидов Шкаф")
},
description = translation.add("once4.desc", "Upgrade your Exopack storage with 150 slots using one module. After you open one, tens meters long racks roll out of it!") {
russian("Улучшите хранилище Экзопака модулем на 150 слотов. Открой один - и покатились стеллажи на десятки метров!")
},
frameType = AdvancementType.CHALLENGE
)
.addCriterion("once4", ExopackSlotsExpandedTrigger.Instance(minGained = 150).criterion())
.save(serializer, modLocation("exopack/once4"))
}

View File

@ -1,53 +1,29 @@
package ru.dbotthepony.mc.otm.datagen.advancements package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.Advancement import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementHolder import net.minecraft.advancements.CriterionTriggerInstance
import net.minecraft.advancements.AdvancementRewards
import net.minecraft.advancements.AdvancementType
import net.minecraft.advancements.Criterion
import net.minecraft.advancements.DisplayInfo import net.minecraft.advancements.DisplayInfo
import net.minecraft.advancements.FrameType
import net.minecraft.advancements.critereon.ContextAwarePredicate import net.minecraft.advancements.critereon.ContextAwarePredicate
import net.minecraft.advancements.critereon.EntityPredicate import net.minecraft.advancements.critereon.EntityPredicate
import net.minecraft.advancements.critereon.InventoryChangeTrigger import net.minecraft.advancements.critereon.InventoryChangeTrigger
import net.minecraft.advancements.critereon.ItemPredicate import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.core.registries.Registries
import net.minecraft.network.chat.Component import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import ru.dbotthepony.mc.otm.util.TextComponent import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.function.Consumer
fun AdvancementBuilder(): Advancement.Builder = Advancement.Builder.advancement() fun AdvancementBuilder(): Advancement.Builder = Advancement.Builder.advancement()
fun Advancement.Builder.save(serializer: Consumer<AdvancementHolder>, name: ResourceLocation): AdvancementHolder {
val built = build(name)
serializer.accept(built)
return built
}
fun advancementLoot(location: ResourceLocation): AdvancementRewards.Builder {
return AdvancementRewards.Builder.loot(ResourceKey.create(Registries.LOOT_TABLE, location))
}
fun advancementLoot(location: String): AdvancementRewards.Builder {
return advancementLoot(modLocation(location))
}
fun AdvancementRewards.Builder.addLootTable(location: ResourceLocation): AdvancementRewards.Builder {
return addLootTable(ResourceKey.create(Registries.LOOT_TABLE, location))
}
fun DisplayInfo( fun DisplayInfo(
itemStack: ItemStack, itemStack: ItemStack,
title: Component = TextComponent("undefined"), title: Component = TextComponent("undefined"),
description: Component = TextComponent("undefined"), description: Component = TextComponent("undefined"),
background: ResourceLocation? = null, background: ResourceLocation? = null,
frameType: AdvancementType = AdvancementType.TASK, frameType: FrameType = FrameType.TASK,
showToast: Boolean = true, showToast: Boolean = true,
announceChat: Boolean = true, announceChat: Boolean = true,
hidden: Boolean = false, hidden: Boolean = false,
@ -71,7 +47,7 @@ fun Advancement.Builder.display(
title: Component = TextComponent("undefined"), title: Component = TextComponent("undefined"),
description: Component = TextComponent("undefined"), description: Component = TextComponent("undefined"),
background: ResourceLocation? = null, background: ResourceLocation? = null,
frameType: AdvancementType = AdvancementType.TASK, frameType: FrameType = FrameType.TASK,
showToast: Boolean = true, showToast: Boolean = true,
announceChat: Boolean = true, announceChat: Boolean = true,
hidden: Boolean = false, hidden: Boolean = false,
@ -81,7 +57,7 @@ fun predicate(tag: TagKey<Item>): ItemPredicate {
return ItemPredicate.Builder.item().of(tag).build() return ItemPredicate.Builder.item().of(tag).build()
} }
fun criterion(tag: TagKey<Item>): Criterion<*> { fun criterion(tag: TagKey<Item>): CriterionTriggerInstance {
return InventoryChangeTrigger.TriggerInstance.hasItems(predicate(tag)) return InventoryChangeTrigger.TriggerInstance.hasItems(predicate(tag))
} }
@ -89,7 +65,7 @@ fun predicate(item: ItemLike): ItemPredicate {
return ItemPredicate.Builder.item().of(item).build() return ItemPredicate.Builder.item().of(item).build()
} }
fun criterion(item: ItemLike): Criterion<*> { fun criterion(item: ItemLike): CriterionTriggerInstance {
return InventoryChangeTrigger.TriggerInstance.hasItems(predicate(item)) return InventoryChangeTrigger.TriggerInstance.hasItems(predicate(item))
} }

View File

@ -1,76 +1,55 @@
package ru.dbotthepony.mc.otm.datagen.advancements package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.AdvancementHolder import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementRequirements import net.minecraft.advancements.RequirementsStrategy
import net.minecraft.advancements.AdvancementType import net.minecraft.network.chat.contents.TranslatableContents
import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraftforge.common.data.ExistingFileHelper
import ru.dbotthepony.mc.otm.util.TranslatableComponent import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.util.key import ru.dbotthepony.mc.otm.core.key
import ru.dbotthepony.mc.otm.util.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider import ru.dbotthepony.mc.otm.datagen.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.server.triggers.TakeItemOutOfReplicatorTrigger import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer import java.util.function.Consumer
data class CraftEntry( private data class CraftEntry(
val item: Collection<Item>, val item: Item,
val englishName: String, val englishName: String,
val englishSuffix: String? = null, val englishSuffix: String? = null,
val russianName: String? = null, val russianName: String? = null,
val russianSuffix: String? = null, val russianSuffix: String? = null,
) { )
constructor(
item: Item,
englishName: String,
englishSuffix: String? = null,
russianName: String? = null,
russianSuffix: String? = null,
) : this(listOf(item), englishName, englishSuffix, russianName, russianSuffix)
fun make(serializer: Consumer<AdvancementHolder>, parent: AdvancementHolder, translation: MatteryLanguageProvider.MultiBuilder): AdvancementHolder { fun addMachineAdvancements(serializer: Consumer<Advancement>, existingFileHelper: ExistingFileHelper, lang: MatteryLanguageProvider) {
val path = item.first().registryName!!.path
val translated = translation.add("$path.desc", "Craft a %s%s") {
russian("Создайте %s%s")
}
val translatedSuffix = translation.add("$path.suffix", if (englishSuffix != null) ". $englishSuffix" else "") {
russian(if (russianSuffix != null) ". $russianSuffix" else "")
}
return AdvancementBuilder()
.parent(parent)
.display(
itemStack = ItemStack(item.first()),
title = translation.add(path, englishName) {
if (russianName != null) {
russian(russianName)
}
},
description = TranslatableComponent(translated.contents.key, item.first().description, translatedSuffix),
)
.also {
for ((i, item) in item.withIndex()) {
it.addCriterion(i.toString(), criterion(item))
}
}
.requirements(AdvancementRequirements.Strategy.OR)
.save(serializer, modLocation("machines/$path"))
}
}
fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLanguageProvider, root: AdvancementHolder) {
val translation = lang.MultiBuilder("otm.advancements.machine") val translation = lang.MultiBuilder("otm.advancements.machine")
val root = AdvancementBuilder()
.requirements(RequirementsStrategy.OR)
.display(
itemStack = ItemStack(MItems.CHEMICAL_GENERATOR),
title = translation.add("root", "Tritanium Empowered Machinery") {
russian("Тританово запитанные механизмы")
},
description = translation.add("root.desc", "Do not drop in anything if you want the latter preserved intact") {
russian("Не роняйте ничего внутрь если хотите чтоб последнее осталось таким, какое оно есть")
},
showToast = false,
announceChat = false,
background = modLocation("textures/block/decorative/floor_tiles_gray.png")
)
.addCriterion("has_machine", criterion(MItemTags.MACHINES))
.addCriterion("has_tritanium_ingot", criterion(MItemTags.TRITANIUM_INGOTS))
.addCriterion("has_tritanium_plate_somehow", criterion(MItemTags.TRITANIUM_PLATES))
.save(serializer, modLocation("machines/root"), existingFileHelper)
val chem = AdvancementBuilder() val chem = AdvancementBuilder()
.parent(root) .parent(root)
.display( .display(
itemStack = ItemStack(MItems.CHEMICAL_GENERATOR[null]!!), itemStack = ItemStack(MItems.CHEMICAL_GENERATOR),
title = translation.add("chemical_generator", "Burning the Organics") { title = translation.add("chemical_generator", "Burning the Organics") {
russian("Сжигание органики") russian("Сжигание органики")
}, },
@ -78,17 +57,13 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Создайте химический генератор. Лучше установить его снаружи") russian("Создайте химический генератор. Лучше установить его снаружи")
}, },
) )
.also { .addCriterion("has_machine", criterion(MItems.CHEMICAL_GENERATOR))
for ((i, v) in MItems.CHEMICAL_GENERATOR.values.withIndex()) .save(serializer, modLocation("machines/chemical_generator"), existingFileHelper)
it.addCriterion("has_machine_$i", criterion(v))
}
.requirements(AdvancementRequirements.Strategy.OR)
.save(serializer, modLocation("machines/chemical_generator"))
val press = AdvancementBuilder() val press = AdvancementBuilder()
.parent(chem) .parent(chem)
.display( .display(
itemStack = ItemStack(MItems.TWIN_PLATE_PRESS[null]!!), itemStack = ItemStack(MItems.PLATE_PRESS),
title = translation.add("plate_press", "Bending the Material") { title = translation.add("plate_press", "Bending the Material") {
russian("Раскатка металла") russian("Раскатка металла")
}, },
@ -96,147 +71,58 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Создайте пресс пластин, не суйте свои или чужие конечности внутрь") russian("Создайте пресс пластин, не суйте свои или чужие конечности внутрь")
}, },
) )
.also { .addCriterion("has_machine", criterion(MItems.PLATE_PRESS))
for ((i, m) in MItems.TWIN_PLATE_PRESS.values.withIndex()) .save(serializer, modLocation("machines/plate_press"), existingFileHelper)
it.addCriterion(i.toString(), criterion(m))
}
.requirements(AdvancementRequirements.Strategy.OR)
.save(serializer, modLocation("machines/plate_press"))
CraftEntry( val entries = listOf(
MItems.ENERGY_SERVO.values, "Power Goes In, Powered Things Go Out", CraftEntry(MItems.MATTER_SCANNER, "Scanning Things that Matter",
russianName = "Энергия на вход, электроинструмент на выход").make(serializer, press, translation) russianName = "Сканируем вещи которые материальны"),
CraftEntry(MItems.PATTERN_STORAGE, "Digital Knowledge Library",
russianName = "Цифровая библиотека знаний"),
CraftEntry(MItems.MATTER_DECOMPOSER, "Decaying the Atoms", "Keep your limbs outside of the working chamber at all times",
russianName = "Разлагаем атомы", russianSuffix = "Во всех ситуациях держите свои конечности вне рабочей камеры"),
CraftEntry(MItems.MATTER_PANEL, "Indexing the Library",
russianName = "Индексируем библиотеку"),
CraftEntry(MItems.MATTER_REPLICATOR, "Local Bakery", "Now let's bake some perfect bread",
russianName = "Местная выпечка", russianSuffix = "А теперь давайте выпечем немного идеального хлеба"),
CraftEntry(MItems.MATTER_BOTTLER, "Transfusing Pure Matter", "For those who loved to play with water in their childhood",
russianName = "Переливаем чистую материю", russianSuffix = "Для тех, кто любил играться в воде в детстве"),
CraftEntry(MItems.MATTER_RECYCLER, "Refine and Redefine", "This is what waste recycling should look like",
russianName = "Переработка и перегонка", russianSuffix = "Вот он, пик переработки отходов"),
CraftEntry(MItems.MATTER_CAPACITOR_BANK, "Modular Matter Tank",
russianName = "Модульный бак материи"),
val scanner = CraftEntry( CraftEntry(MItems.ENERGY_COUNTER, "Visualize Power Burn",
MItems.MATTER_SCANNER.values, "Scanning Things that Matter", russianName = "Визуализация сжигания энергии"),
russianName = "Сканируем вещи которые материальны") CraftEntry(MItems.BATTERY_BANK, "Batteries Not Included", "By all means avoid the urge to hammer incompatible batteries into the power bus.",
val decomposer = CraftEntry( russianName = "Батарейки в комплект не входят", russianSuffix = "Пожалуйста, воздержитесь от вбивания кувалдой несовместимых батарей в энергетическую шину."),
MItems.MATTER_DECOMPOSER.values, "Decaying the Atoms", "Keep your limbs outside of the working chamber at all times",
russianName = "Разлагаем атомы", russianSuffix = "Во всех ситуациях держите свои конечности вне рабочей камеры")
val panel = CraftEntry(
MItems.MATTER_PANEL.values, "Indexing the Library",
russianName = "Индексируем библиотеку")
val replicator = CraftEntry(
MItems.MATTER_REPLICATOR.values, "Cook with (Im)Perfection", "Now let's bake some perfect bread",
russianName = "Повар с (не) идеальностями", russianSuffix = "А теперь давайте выпечем немного идеального хлеба")
val bottler = CraftEntry(
MItems.MATTER_BOTTLER.values, "Transfusing Pure Matter", "For those who loved to play with water in their childhood",
russianName = "Переливаем чистую материю", russianSuffix = "Для тех, кто любил играться в воде в детстве")
val recycler = CraftEntry(
MItems.MATTER_RECYCLER.values, "Refine and Redefine", "This is what waste recycling should look like",
russianName = "Переработка и перегонка", russianSuffix = "Вот он, пик переработки отходов")
val capacitor = CraftEntry(
MItems.MATTER_CAPACITOR_BANK.values, "Modular Matter Tank",
russianName = "Модульный бак материи")
val counter = CraftEntry(
MItems.ENERGY_COUNTER.values, "Visualize Power Burn",
russianName = "Визуализация сжигания энергии")
val battery = CraftEntry(
MItems.BATTERY_BANK.values, "Batteries Not Included", "By all means avoid the urge to hammer incompatible batteries into the power bus.",
russianName = "Батарейки в комплект не входят", russianSuffix = "Пожалуйста, воздержитесь от вбивания кувалдой несовместимых батарей в энергетическую шину.")
val pattern = CraftEntry(
MItems.PATTERN_STORAGE, "Digital Knowledge Library",
russianName = "Цифровая библиотека знаний")
val reconstructor = CraftEntry(
MItems.MATTER_RECONSTRUCTOR.values, "Flipping Hourglass",
russianName = "Переворачиваем песочные часы")
decomposer.make(serializer, press, translation).also {
pattern.make(serializer, it, translation).also {
scanner.make(serializer, it, translation)
panel.make(serializer, it, translation)
replicator.make(serializer, it, translation).also {
AdvancementBuilder()
.parent(it)
.display(
itemStack = ItemStack(Items.BREAD),
title = translation.add("replicate_something", "Local Bakery") {
russian("Местная выпечка")
},
description = translation.add("replicate_something.desc", "Replicate something using Matter Replicator. If you replicated some food, be first to taste it among your company") {
russian("Среплицируйте что либо используя репликатор материи. Если это еда, то не стесняйтесь быть первым, кто попробует её на вкус среди вашей компании")
},
frameType = AdvancementType.GOAL
) )
.addCriterion("replicate_something", TakeItemOutOfReplicatorTrigger.Instance(ItemPredicate.Builder.item().of(
MItems.MATTER_DUST).build(), true).criterion())
.save(serializer, modLocation("machines/replicate_something"))
AdvancementBuilder() val built = mutableMapOf<Item, Advancement>()
.parent(it)
for (entry in entries) {
val path = entry.item.registryName!!.path
val translated = translation.add("$path.desc", "Craft a %s%s") {
russian("Создайте %s%s")
}
val translatedSuffix = translation.add("$path.suffix", if (entry.englishSuffix != null) ". " + entry.englishSuffix else "") {
russian(if (entry.russianSuffix != null) ". " + entry.russianSuffix else "")
}
built[entry.item] = AdvancementBuilder()
.parent(press)
.display( .display(
hidden = true, itemStack = ItemStack(entry.item),
itemStack = ItemStack(MItems.MATTER_DUST), title = translation.add(path, entry.englishName) {
title = translation.add("replicate_failure", "Unhealthy Flavor") { if (entry.russianName != null) {
russian("Вредная посыпка") russian(entry.russianName)
}, }
description = translation.add("replicate_failure.desc", "Experience replication failure and have your thing turn into matter dust") {
russian("Наблюдайте неудачный результат репликации, где ваш заказ рассыпался в материальную труху")
}, },
description = TranslatableComponent(translated.contents.key, entry.item.description, translatedSuffix),
) )
.addCriterion("replicate_failure", TakeItemOutOfReplicatorTrigger.Instance(ItemPredicate.Builder.item().of( .addCriterion("has_machine", criterion(entry.item))
MItems.MATTER_DUST).build()).criterion()) .save(serializer, modLocation("machines/$path"), existingFileHelper)
.save(serializer, modLocation("machines/replicate_failure"))
}
reconstructor.make(serializer, it, translation)
}
bottler.make(serializer, it, translation)
recycler.make(serializer, it, translation)
capacitor.make(serializer, it, translation)
}
counter.make(serializer, press, translation).also {
battery.make(serializer, it, translation)
}
val station = CraftEntry(
MItems.ANDROID_STATION.values, "Android Home Page",
russianName = "Домашняя страница андроидов",
russianSuffix = "Только пользоваться этим устройством могут вёдра с болтами",
englishSuffix = "Except only buckets of bolts can use this thing")
val charger = CraftEntry(
MItems.ANDROID_CHARGER.values, "Android Home Router",
russianName = "Домашняя страница андроидов")
station.make(serializer, press, translation).also {
charger.make(serializer, it, translation)
}
CraftEntry(
MItems.COBBLESTONE_GENERATOR.values, "Cobblestone: Infinity + 1",
russianName = "Булыжник: бесконечность + 1",
russianSuffix = "Смотрите, чтоб он не просыпался во все сундуки",
englishSuffix = "Watch for not to spill it over all your chests").make(serializer, press, translation)
.also {
CraftEntry(
MItems.INFINITE_WATER_SOURCE, "We Got A Leak!",
russianName = "У нас утечка!",
russianSuffix = "Как это вообще возможно!?",
englishSuffix = "How is that even possible!?")
.make(serializer, it, translation)
}
CraftEntry(
MItems.POWERED_FURNACE.values, "One Big Resistor",
russianName = "Один большой резистор",
russianSuffix = "Каждый элемент электрической цепи способен испускать свет и тепло, единожды.",
englishSuffix = "Any electrical element can emit light and heat, once.")
.make(serializer, press, translation)
.also {
CraftEntry(
MItems.POWERED_BLAST_FURNACE.values, "Big Microwave Oven",
russianName = "Большая микроволновая печь").make(serializer, it, translation)
CraftEntry(
MItems.POWERED_SMOKER.values, "Small Microwave Oven",
russianName = "Маленькая микроволновая печь").make(serializer, it, translation)
} }
} }

View File

@ -1,16 +1,15 @@
package ru.dbotthepony.mc.otm.datagen.blocks package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.neoforged.neoforge.client.model.generators.BlockStateProvider import net.minecraftforge.client.model.generators.BlockStateProvider
import net.neoforged.neoforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
import net.neoforged.neoforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.util.get import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
private fun nothingOrNumber(input: Int): String { private fun nothingOrNumber(input: Int): String {
if (input == 0) if (input == 0)
@ -19,35 +18,35 @@ private fun nothingOrNumber(input: Int): String {
return (input - 1).toString() return (input - 1).toString()
} }
open class BatteryBankProvider(event: GatherDataEvent, val color: DyeColor?) : BlockStateProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) { open class BatteryBankProvider(event: GatherDataEvent) : BlockStateProvider(event.generator.packOutput, DataGen.MOD_ID, event.existingFileHelper) {
protected var block = "battery_bank" protected var block = "battery_bank"
protected var batteryPath = "block/battery/battery" protected var batteryPath = "block/battery/battery"
protected var registry: Block = MBlocks.BATTERY_BANK[color]!! protected var registry: Block = MBlocks.BATTERY_BANK
override fun registerStatesAndModels() { override fun registerStatesAndModels() {
with(getVariantBuilder(registry)) { with(getVariantBuilder(registry)) {
forAllStates { forAllStates {
ConfiguredModel.builder() ConfiguredModel.builder()
.modelFile(models().getExistingFile(modLocation("block/$block${if (color != null) "_${color.name.lowercase()}" else ""}"))) .modelFile(models().getExistingFile(modLocation("block/$block")))
.rotationY(it[BlockRotationFreedom.HORIZONTAL.property].front.yRotationBlockstateNorth()) .rotationY(it[BlockRotationFreedom.ONE.property].front.yRotationBlockstateNorth())
.build() .build()
} }
} }
} }
override fun getName(): String { override fun getName(): String {
return "Battery Bank Model Provider for color $color" return "Battery Bank Model Provider"
} }
} }
class MatterBankProvider(event: GatherDataEvent, color: DyeColor?) : BatteryBankProvider(event, color) { class MatterBankProvider(event: GatherDataEvent) : BatteryBankProvider(event) {
init { init {
block = "matter_capacitor_bank" block = "matter_capacitor_bank"
batteryPath = "block/battery/matter_capacitor" batteryPath = "block/battery/matter_capacitor"
registry = MBlocks.MATTER_CAPACITOR_BANK[color]!! registry = MBlocks.MATTER_CAPACITOR_BANK
} }
override fun getName(): String { override fun getName(): String {
return "Matter Bank Model Provider for color $color" return "Matter Bank Model Provider"
} }
} }

View File

@ -1,117 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.blocks
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider
import ru.dbotthepony.mc.otm.registry.game.MBlocks
fun addBlockModels(provider: MatteryBlockModelProvider) {
with(provider) {
resourceCubeAll(MBlocks.TRITANIUM_ORE)
resourceCubeAll(MBlocks.TRITANIUM_RAW_BLOCK)
resourceCubeAll(MBlocks.DEEPSLATE_TRITANIUM_ORE)
resourceCubeAll(MBlocks.TRITANIUM_INGOT_BLOCK)
resourceCubeAll(MBlocks.WITHERED_STEEL_BLOCK)
resourceCubeAll(MBlocks.DILITHIUM_ORE)
resourceCubeAll(MBlocks.DEEPSLATE_DILITHIUM_ORE)
resourceCubeAll(MBlocks.DILITHIUM_CRYSTAL_BLOCK)
provider.exec {
provider.cubeAll("reinforced_redstone_lamp", modLocation("block/reinforced_redstone_lamp"))
provider.cubeAll("reinforced_redstone_lamp_on", modLocation("block/reinforced_redstone_lamp_on"))
}
cubeAll(MBlocks.FLYWHEEL_HOUSING)
column(MBlocks.FLYWHEEL_BEARING, "block/flywheel_bearing","block/flywheel_bearing_top")
column(MBlocks.FLYWHEEL_SHAFT, "block/flywheel_shaft","block/flywheel_shaft_top")
orientable(MBlocks.FLYWHEEL_BATTERY,"block/flywheel_housing","block/flywheel_controller")
column(MBlocks.GENERATOR_BLOCK, "block/generator_block","block/generator_block_top")
cubeAllFramed("modular_frame", "block/modular_frame")
cubeAllFramed("heavy_modular_frame", "block/heavy_modular_frame")
cubeAll(MBlocks.ENERGY_INPUT_INTERFACE)
cubeAll(MBlocks.ENERGY_OUTPUT_INTERFACE)
cubeAll(MBlocks.TRITANIUM_HULL)
orientable(MBlocks.MATTER_INPUT_HATCH,"block/tritanium_hull","block/matter_input_hatch")
orientable(MBlocks.MATTER_OUTPUT_HATCH,"block/tritanium_hull","block/matter_output_hatch")
orientable(MBlocks.ENERGY_INPUT_HATCH,"block/tritanium_hull","block/energy_input_hatch")
orientable(MBlocks.ENERGY_OUTPUT_HATCH,"block/tritanium_hull","block/energy_output_hatch")
orientable(MBlocks.ITEM_INPUT_HATCH,"block/tritanium_hull","block/item_input_hatch")
orientable(MBlocks.ITEM_OUTPUT_HATCH,"block/tritanium_hull","block/item_output_hatch")
cable("crude_energy_cable", "block/power_cable_0", powered = true)
cable("regular_energy_cable", "block/power_cable_1", powered = true)
cable("advanced_energy_cable", "block/power_cable_2", powered = true)
cable("superconductor_energy_cable", "block/power_cable_3", powered = true)
cable("matter_cable", "block/matter_cable", thin = true)
cable("storage_cable", "block/storage_cable")
colored(MBlocks.COBBLESTONE_GENERATOR, listOf("0", "particle"))
colored(MBlocks.ITEM_MONITOR, listOf("0", "particle"))
colored(MBlocks.MATTER_RECONSTRUCTOR, listOf("0", "particle"))
colored(MBlocks.ENERGY_SERVO, listOf("0", "particle"))
colored("essence_storage", "_empty", listOf("0"))
colored("essence_storage", "_filled", listOf("0"))
colored("matter_capacitor_bank", listOf("1", "particle"), "mattercapacitorbank_frame")
colored("battery_bank", listOf("0", "particle"), "batterybank_frame")
colored("android_charger", "_base", listOf("0", "particle"))
colored("android_charger", "_middle", listOf("0", "particle"))
colored("android_charger", "_top", listOf("0", "particle"))
colored("chemical_generator", "_idle", listOf("0", "particle"))
colored("chemical_generator", "_working", listOf("0", "particle"))
colored("storage_power_supplier", listOf("0", "particle"))
colored("matter_panel", listOf("texture", "particle"))
colored("drive_viewer", "_idle", listOf("texture", "particle"))
colored("drive_viewer", "_working", listOf("texture", "particle"))
coloredMachineCombined("plate_press", "plate_press2", listOf("0", "particle"))
coloredMachineCombined("twin_plate_press", "plate_press2", listOf("0", "particle"))
coloredMachineCombined("matter_recycler", listOf("0", "particle"))
coloredMachineCombined("matter_scanner", listOf("texture", "particle"))
coloredMachineCombined("matter_bottler", listOf("texture", "particle"))
coloredMachineCombined("matter_decomposer", listOf("texture", "particle"))
coloredMachineCombined("matter_recycler", listOf("0", "particle"))
colored("matter_replicator", "_idle", mapOf("1" to "matter_replicator_base", "particle" to "matter_replicator_base", "texture" to "matter_replicator"))
colored("matter_replicator", "_error", mapOf("1" to "matter_replicator_base", "particle" to "matter_replicator_base", "texture" to "matter_replicator"))
colored("matter_replicator", "_working", mapOf("1" to "matter_replicator_base", "particle" to "matter_replicator_base", "texture" to "matter_replicator"))
colored("powered_smoker", "_idle", mapOf("0" to "powered_smoker_base", "1" to "powered_smoker_interior_0", "particle" to "powered_smoker_base"))
colored("powered_smoker", "_error", mapOf("0" to "powered_smoker_base", "1" to "powered_smoker_interior_2", "particle" to "powered_smoker_base"))
colored("powered_smoker", "_working", mapOf("0" to "powered_smoker_base", "1" to "powered_smoker_interior_1", "particle" to "powered_smoker_base"))
colored("powered_furnace", "_idle", mapOf("0" to "electric_furnace_offline", "particle" to "electric_furnace_offline"))
colored("powered_furnace", "_error", mapOf("0" to "electric_furnace_offline", "particle" to "electric_furnace_offline"))
colored("powered_furnace", "_working", mapOf("0" to "electric_furnace", "particle" to "electric_furnace"))
colored("powered_blast_furnace", "_idle", mapOf("texture" to "induction_furnace_offline", "particle" to "induction_furnace_offline"))
colored("powered_blast_furnace", "_error", mapOf("texture" to "induction_furnace_offline", "particle" to "induction_furnace_offline"))
colored("powered_blast_furnace", "_working", mapOf("texture" to "induction_furnace", "particle" to "induction_furnace"))
colored("android_station", "_idle", mapOf("1" to "android_station_base", "particle" to "android_station_base"))
colored("android_station", "_working", mapOf("2" to "android_station_base", "particle" to "android_station_base"))
val energyCounter = setOf(
"down", "east", "north", "south",
"north_down", "north_east", "north_west",
"south_down", "south_east", "south_west",
"up", "west",
)
for (model in energyCounter) {
colored("energy_counter_$model", listOf("texture", "particle"), "energy_counter")
}
}
}

View File

@ -2,182 +2,93 @@ package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.world.level.block.state.properties.BlockStateProperties import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.neoforged.neoforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
import ru.dbotthepony.mc.otm.block.CableBlock import ru.dbotthepony.mc.otm.block.CableBlock
import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock import ru.dbotthepony.mc.otm.block.decorative.CargoCrateBlock
import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.block.entity.WorkerState
import ru.dbotthepony.mc.otm.block.matter.MatterBottlerBlock import ru.dbotthepony.mc.otm.block.matter.MatterBottlerBlock
import ru.dbotthepony.mc.otm.block.tech.AndroidChargerBlock import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.block.tech.EssenceStorageBlock import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.ResourceLocation import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateSouth
import ru.dbotthepony.mc.otm.util.get import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateSouth
import ru.dbotthepony.mc.otm.util.math.xRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.util.math.xRotationBlockstateSouth
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateSouth
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MNames import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.ArrayList
fun addBlockStates(provider: MatteryBlockStateProvider) { fun addBlockStates(provider: MatteryBlockStateProvider) {
provider.block(MBlocks.BLACK_HOLE) provider.block(MBlocks.BLACK_HOLE)
provider.block(MBlocks.ANDROID_STATION.values) provider.block(MBlocks.ANDROID_STATION)
provider.ore(MBlocks.DEEPSLATE_TRITANIUM_ORE) provider.ore(MBlocks.DEEPSLATE_TRITANIUM_ORE)
provider.ore(MBlocks.TRITANIUM_ORE) provider.ore(MBlocks.TRITANIUM_ORE)
provider.ore(MBlocks.TRITANIUM_RAW_BLOCK) provider.ore(MBlocks.TRITANIUM_RAW_BLOCK)
provider.block(MBlocks.TRITANIUM_INGOT_BLOCK) provider.block(MBlocks.TRITANIUM_INGOT_BLOCK)
provider.block(MBlocks.METAL_MESH)
provider.block(MBlocks.WITHERED_STEEL_BLOCK) provider.block(MBlocks.CHEMICAL_GENERATOR)
provider.exec { provider.block(MBlocks.MATTER_SCANNER)
provider.getVariantBuilder(MBlocks.ROFLITE_ALLOY_BLOCK).forAllStates { provider.block(MBlocks.ITEM_MONITOR)
val side1 = modLocation("block/resource/roflite_alloy_1")
val side2 = modLocation("block/resource/roflite_alloy_2")
val top = modLocation("block/resource/roflite_alloy_top")
val a = provider.models().cube(MBlocks.ROFLITE_ALLOY_BLOCK.registryName!!.path, top, top, side1, side1, side2, side2).texture("particle", side1)
val b = provider.models().cube("${MBlocks.ROFLITE_ALLOY_BLOCK.registryName!!.path}_b", top, top, side2, side2, side1, side1).texture("particle", side2)
return@forAllStates arrayOf(ConfiguredModel.builder().modelFile(a).buildLast(), ConfiguredModel.builder().modelFile(b).buildLast())
}
}
provider.ore(MBlocks.DILITHIUM_ORE)
provider.ore(MBlocks.DEEPSLATE_DILITHIUM_ORE)
provider.block(MBlocks.DILITHIUM_CRYSTAL_BLOCK)
provider.block(MBlocks.CHEMICAL_GENERATOR.values)
provider.block(MBlocks.MATTER_SCANNER.values)
provider.block(MBlocks.ITEM_MONITOR.values)
provider.block(MBlocks.HOLO_SIGN) provider.block(MBlocks.HOLO_SIGN)
provider.exec { provider.exec {
with(provider.getMultipartBuilder(MBlocks.PHANTOM_ATTRACTOR)) { with(provider.getMultipartBuilder(MBlocks.PHANTOM_ATTRACTOR)) {
for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) { for (dir in BlockRotationFreedom.ONE.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("block/${MNames.PHANTOM_ATTRACTOR}"))) part().modelFile(provider.models().getExistingFile(modLocation("block/${MNames.PHANTOM_ATTRACTOR}")))
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockStateProperties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.LOWER) .condition(BlockStateProperties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.LOWER)
.condition(BlockRotationFreedom.HORIZONTAL.property, dir) .condition(BlockRotationFreedom.ONE.property, dir)
.end() .end()
} }
} }
for (block in MBlocks.ANDROID_CHARGER.values) { with(provider.getMultipartBuilder(MBlocks.MATTER_BOTTLER)) {
with(provider.getMultipartBuilder(block)) { for (dir in BlockRotationFreedom.ONE.possibleValues) {
for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) {
for (part in AndroidChargerBlock.PART.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("block/${block.registryName!!.path}_${part.serializedName}")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(AndroidChargerBlock.PART, part)
.condition(BlockRotationFreedom.HORIZONTAL.property, dir)
.end()
}
}
}
}
for (block in MBlocks.MATTER_BOTTLER.values) {
with(provider.getMultipartBuilder(block)) {
for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) {
for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) { for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}"))) part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}")))
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, dir) .condition(BlockRotationFreedom.ONE.property, dir)
.condition(WorkerState.WORKER_STATE, enum) .condition(WorkerState.WORKER_STATE, enum)
.end() .end()
} }
} }
for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) { for (dir in BlockRotationFreedom.ONE.possibleValues) {
for (enum in MatterBottlerBlock.SLOT_PROPERTIES) { for (enum in MatterBottlerBlock.SLOT_PROPERTIES) {
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_open"))) part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_open")))
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, dir) .condition(BlockRotationFreedom.ONE.property, dir)
.condition(enum, false) .condition(enum, false)
.end() .end()
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_closed"))) part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_closed")))
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, dir) .condition(BlockRotationFreedom.ONE.property, dir)
.condition(enum, true) .condition(enum, true)
.end() .end()
} }
} }
} }
} }
}
provider.block(MBlocks.MATTER_DECOMPOSER.values) provider.block(MBlocks.MATTER_DECOMPOSER)
provider.block(MBlocks.MATTER_REPLICATOR.values) provider.block(MBlocks.MATTER_REPLICATOR)
provider.block(MBlocks.MATTER_ENTANGLER) provider.block(MBlocks.PLATE_PRESS)
provider.block(MBlocks.PLATE_PRESS.values)
provider.block(MBlocks.TWIN_PLATE_PRESS.values)
provider.block(MBlocks.GRAVITATION_STABILIZER) provider.block(MBlocks.GRAVITATION_STABILIZER)
provider.block(MBlocks.GRAVITATION_STABILIZER_LENS) provider.block(MBlocks.GRAVITATION_STABILIZER_LENS)
provider.block(MBlocks.POWERED_BLAST_FURNACE.values) provider.block(MBlocks.STORAGE_POWER_SUPPLIER)
provider.block(MBlocks.POWERED_FURNACE.values) provider.block(MBlocks.MATTER_RECYCLER)
provider.block(MBlocks.POWERED_SMOKER.values) provider.block(MBlocks.MATTER_RECONSTRUCTOR)
provider.block(MBlocks.ENERGY_SERVO)
provider.block(MBlocks.STORAGE_POWER_SUPPLIER.values) provider.block(MBlocks.COBBLESTONE_GENERATOR)
provider.block(MBlocks.MATTER_PANEL.values) provider.block(MBlocks.ESSENCE_STORAGE)
provider.block(MBlocks.MATTER_RECYCLER.values)
provider.block(MBlocks.MATTER_RECONSTRUCTOR.values)
provider.block(MBlocks.ENERGY_SERVO.values)
provider.block(MBlocks.COBBLESTONE_GENERATOR.values)
provider.block(MBlocks.DRIVE_RACK)
provider.block(MBlocks.PAINTER)
provider.block(MBlocks.INFINITE_WATER_SOURCE)
provider.exec {
provider.getVariantBuilder(MBlocks.REDSTONE_LAMP_INVERTED)
.forAllStates {
ConfiguredModel.builder()
.modelFile(provider.models().getExistingFile(ResourceLocation("minecraft", "redstone_lamp${if (it[BlockStateProperties.LIT]) "" else "_on"}")))
.build()
}
provider.getVariantBuilder(MBlocks.REINFORCED_REDSTONE_LAMP)
.forAllStates {
ConfiguredModel.builder()
.modelFile(provider.models().getExistingFile(modLocation("reinforced_redstone_lamp${if (it[BlockStateProperties.LIT]) "_on" else ""}")))
.build()
}
provider.getVariantBuilder(MBlocks.REINFORCED_REDSTONE_LAMP_INVERTED)
.forAllStates {
ConfiguredModel.builder()
.modelFile(provider.models().getExistingFile(modLocation("reinforced_redstone_lamp${if (it[BlockStateProperties.LIT]) "" else "_on"}")))
.build()
}
}
provider.exec {
for (block in MBlocks.ESSENCE_STORAGE.values) {
provider.getVariantBuilder(block).forAllStates {
return@forAllStates arrayOf(
ConfiguredModel.builder()
.modelFile(provider.models().getExistingFile(
modLocation("${block.registryName!!.path}_${if (it.getValue(
EssenceStorageBlock.FILLED)) "filled" else "empty"}")
))
.rotationY(it.getValue(BlockRotationFreedom.HORIZONTAL.property).front.yRotationBlockstateNorth())
.buildLast()
)
}
}
}
provider.exec { provider.exec {
for (crate in MRegistry.CARGO_CRATES.allBlocks.values) { for (crate in MRegistry.CARGO_CRATES.allBlocks.values) {
@ -188,19 +99,19 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
modLocation("${crate.registryName!!.path}_${if (it.getValue( modLocation("${crate.registryName!!.path}_${if (it.getValue(
CargoCrateBlock.IS_OPEN)) "open" else "closed"}") CargoCrateBlock.IS_OPEN)) "open" else "closed"}")
)) ))
.rotationY(it.getValue(BlockRotationFreedom.HORIZONTAL.property).front.yRotationBlockstateNorth()) .rotationY(it.getValue(BlockRotationFreedom.ONE.property).front.yRotationBlockstateNorth())
.buildLast() .buildLast()
) )
} }
} }
with(provider.getMultipartBuilder(MBlocks.STORAGE_BUS)) { with(provider.getMultipartBuilder(MBlocks.STORAGE_BUS)) {
for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) { for (dir in BlockRotationFreedom.TWO.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("storage_bus"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_bus")))
.rotationX(dir.front.xRotationBlockstateNorth()) .rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.DIRECTIONAL.property, dir) .condition(BlockRotationFreedom.TWO.property, dir)
.end() .end()
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
@ -216,12 +127,12 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
} }
with(provider.getMultipartBuilder(MBlocks.STORAGE_IMPORTER)) { with(provider.getMultipartBuilder(MBlocks.STORAGE_IMPORTER)) {
for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) { for (dir in BlockRotationFreedom.TWO.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("storage_importer"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_importer")))
.rotationX(dir.front.xRotationBlockstateNorth()) .rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.DIRECTIONAL.property, dir) .condition(BlockRotationFreedom.TWO.property, dir)
.end() .end()
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
@ -237,12 +148,12 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
} }
with(provider.getMultipartBuilder(MBlocks.STORAGE_EXPORTER)) { with(provider.getMultipartBuilder(MBlocks.STORAGE_EXPORTER)) {
for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) { for (dir in BlockRotationFreedom.TWO.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("storage_exporter"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_exporter")))
.rotationX(dir.front.xRotationBlockstateNorth()) .rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth()) .rotationY(dir.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.DIRECTIONAL.property, dir) .condition(BlockRotationFreedom.TWO.property, dir)
.end() .end()
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
@ -256,121 +167,5 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core"))) part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core")))
.addModel().end() .addModel().end()
} }
with(provider.getMultipartBuilder(MBlocks.MATTER_CABLE)) {
for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("matter_cable_connection")))
.rotationX(dir.front.xRotationBlockstateSouth())
.rotationY(dir.front.yRotationBlockstateSouth())
.addModel()
.condition(CableBlock.MAPPING_CONNECTION_PROP[dir.front]!!, true)
.end()
} }
part().modelFile(provider.models().getExistingFile(modLocation("matter_cable_core")))
.addModel().end()
}
with(provider.getMultipartBuilder(MBlocks.STORAGE_CABLE)) {
for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
.rotationX(dir.front.xRotationBlockstateSouth())
.rotationY(dir.front.yRotationBlockstateSouth())
.addModel()
.condition(CableBlock.MAPPING_CONNECTION_PROP[dir.front]!!, true)
.end()
}
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_core")))
.addModel().end()
}
for (block in MBlocks.ENERGY_CABLES) {
with(provider.getMultipartBuilder(block.value)) {
for (dir in BlockRotationFreedom.DIRECTIONAL.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("${block.value.registryName!!.path}_connection")))
.rotationX(dir.front.xRotationBlockstateSouth())
.rotationY(dir.front.yRotationBlockstateSouth())
.addModel()
.condition(CableBlock.MAPPING_CONNECTION_PROP[dir.front]!!, true)
.condition(BlockStateProperties.POWERED, false)
.end()
part().modelFile(provider.models().getExistingFile(modLocation("${block.value.registryName!!.path}_connection_powered")))
.rotationX(dir.front.xRotationBlockstateSouth())
.rotationY(dir.front.yRotationBlockstateSouth())
.addModel()
.condition(CableBlock.MAPPING_CONNECTION_PROP[dir.front]!!, true)
.condition(BlockStateProperties.POWERED, true)
.end()
}
part().modelFile(provider.models().getExistingFile(modLocation("${block.value.registryName!!.path}_core")))
.addModel().condition(BlockStateProperties.POWERED, false).end()
part().modelFile(provider.models().getExistingFile(modLocation("${block.value.registryName!!.path}_core_powered")))
.addModel().condition(BlockStateProperties.POWERED, true).end()
}
}
provider.getVariantBuilder(MBlocks.METAL_JUNK).forAllStates {
val generated = ArrayList<ConfiguredModel>()
for (suffix in arrayOf("_a", "_b", "_c", "_d")) {
val model = provider.models().cubeAll("block/metal_junk$suffix", modLocation("block/decorative/metal_junk$suffix"))
generated.add(with(ConfiguredModel.builder()) {
modelFile(model)
return@with buildLast()
})
generated.add(with(ConfiguredModel.builder()) {
modelFile(model)
rotationY(180)
return@with buildLast()
})
}
return@forAllStates generated.toTypedArray()
}
provider.getVariantBuilder(MBlocks.DANGER_STRIPE_BLOCK).forAllStates {
val generated = ArrayList<ConfiguredModel>()
for (suffix in arrayOf("_0", "_1")) {
generated.add(with(ConfiguredModel.builder()) {
modelFile(provider.models().cubeAll("block/danger_stripe_block$suffix", modLocation("block/decorative/danger_stripe_block$suffix")))
return@with buildLast()
})
}
return@forAllStates generated.toTypedArray()
}
}
provider.block(MBlocks.TRITANIUM_HULL)
provider.block(MBlocks.FLYWHEEL_HOUSING)
provider.block(MBlocks.FLYWHEEL_BEARING)
provider.block(MBlocks.FLYWHEEL_SHAFT)
provider.block(MBlocks.FLYWHEEL_BATTERY)
provider.block(MBlocks.GENERATOR_BLOCK)
provider.block(MBlocks.MODULAR_FRAME)
provider.block(MBlocks.HEAVY_MODULAR_FRAME)
provider.block(MBlocks.ENERGY_INPUT_INTERFACE)
provider.block(MBlocks.ENERGY_OUTPUT_INTERFACE)
provider.block(MBlocks.ENERGY_INPUT_HATCH)
provider.block(MBlocks.ENERGY_OUTPUT_HATCH)
provider.block(MBlocks.MATTER_INPUT_HATCH)
provider.block(MBlocks.MATTER_OUTPUT_HATCH)
provider.block(MBlocks.ITEM_INPUT_HATCH)
provider.block(MBlocks.ITEM_OUTPUT_HATCH)
} }

View File

@ -5,72 +5,67 @@ import ru.dbotthepony.mc.otm.block.tech.EnergyCounterBlock
import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.block.entity.WorkerState
import ru.dbotthepony.mc.otm.block.matter.PatternStorageBlock import ru.dbotthepony.mc.otm.block.matter.PatternStorageBlock
import ru.dbotthepony.mc.otm.block.storage.DriveViewerBlock import ru.dbotthepony.mc.otm.block.storage.DriveViewerBlock
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
fun addComplexBlockStates(provider: MatteryBlockStateProvider) { fun addComplexBlockStates(provider: MatteryBlockStateProvider) {
for (block in MBlocks.DRIVE_VIEWER.values) { with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) {
with(provider.getMultipartBuilder(block)) { for (facing in BlockRotationFreedom.ONE.possibleValues) {
for (facing in BlockRotationFreedom.HORIZONTAL.possibleValues) {
part() part()
.modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_drive_part"))) .modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_drive_part")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, facing) .condition(BlockRotationFreedom.ONE.property, facing)
.condition(DriveViewerBlock.DRIVE_PRESENT, true) .condition(DriveViewerBlock.DRIVE_PRESENT, true)
for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) { for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) {
part() part()
.modelFile(provider.models().getExistingFile(modLocation("block/${block.registryName!!.path}_${workState.name.lowercase()}"))) .modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_${workState.name.lowercase()}")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(WorkerState.SEMI_WORKER_STATE, workState) .condition(WorkerState.SEMI_WORKER_STATE, workState)
.condition(BlockRotationFreedom.HORIZONTAL.property, facing) .condition(BlockRotationFreedom.ONE.property, facing)
}
} }
} }
} }
with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) { with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) {
for (facing in BlockRotationFreedom.HORIZONTAL.possibleValues) { for (facing in BlockRotationFreedom.ONE.possibleValues) {
part() part()
.modelFile(provider.models().getExistingFile(modLocation("block/pattern_storage"))) .modelFile(provider.models().getExistingFile(modLocation("block/pattern_storage")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, facing) .condition(BlockRotationFreedom.ONE.property, facing)
for (i in 0 .. 7) { for (i in 0 .. 7) {
part() part()
.modelFile(provider.models().getExistingFile(modLocation("block/pattern/model$i"))) .modelFile(provider.models().getExistingFile(modLocation("block/pattern/model$i")))
.rotationY(facing.front.yRotationBlockstateNorth()) .rotationY(facing.front.yRotationBlockstateNorth())
.addModel() .addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, facing) .condition(BlockRotationFreedom.ONE.property, facing)
.condition(PatternStorageBlock.PATTERN_STORAGE_DISKS_PROPS[i], true) .condition(PatternStorageBlock.PATTERN_STORAGE_DISKS_PROPS[i], true)
} }
} }
} }
for ((dye, block) in MBlocks.ENERGY_COUNTER) { with(provider.getMultipartBuilder(MBlocks.ENERGY_COUNTER)) {
with(provider.getMultipartBuilder(block)) {
val dyeName = dye?.name?.lowercase()?.let { "_$it" } ?: ""
// даваааййй // даваааййй
val up = provider.models().getExistingFile(modLocation("block/energy_counter_up$dyeName")) val up = provider.models().getExistingFile(modLocation("block/energy_counter_up"))
val down = provider.models().getExistingFile(modLocation("block/energy_counter_down$dyeName")) val down = provider.models().getExistingFile(modLocation("block/energy_counter_down"))
val west = provider.models().getExistingFile(modLocation("block/energy_counter_west$dyeName")) val west = provider.models().getExistingFile(modLocation("block/energy_counter_west"))
val east = provider.models().getExistingFile(modLocation("block/energy_counter_east$dyeName")) val east = provider.models().getExistingFile(modLocation("block/energy_counter_east"))
// ДАААА ДАВАЙЙ ДАААВАААЙЙЙЙЙЙ // ДАААА ДАВАЙЙ ДАААВАААЙЙЙЙЙЙ
val north = provider.models().getExistingFile(modLocation("block/energy_counter_north$dyeName")) val north = provider.models().getExistingFile(modLocation("block/energy_counter_north"))
val northDown = provider.models().getExistingFile(modLocation("block/energy_counter_north_down$dyeName")) val northDown = provider.models().getExistingFile(modLocation("block/energy_counter_north_down"))
val northEast = provider.models().getExistingFile(modLocation("block/energy_counter_north_east$dyeName")) val northEast = provider.models().getExistingFile(modLocation("block/energy_counter_north_east"))
val northWest = provider.models().getExistingFile(modLocation("block/energy_counter_north_west$dyeName")) val northWest = provider.models().getExistingFile(modLocation("block/energy_counter_north_west"))
val south = provider.models().getExistingFile(modLocation("block/energy_counter_south$dyeName")) val south = provider.models().getExistingFile(modLocation("block/energy_counter_south"))
val southDown = provider.models().getExistingFile(modLocation("block/energy_counter_south_down$dyeName")) val southDown = provider.models().getExistingFile(modLocation("block/energy_counter_south_down"))
val southEast = provider.models().getExistingFile(modLocation("block/energy_counter_south_east$dyeName")) val southEast = provider.models().getExistingFile(modLocation("block/energy_counter_south_east"))
val southWest = provider.models().getExistingFile(modLocation("block/energy_counter_south_west$dyeName")) val southWest = provider.models().getExistingFile(modLocation("block/energy_counter_south_west"))
for (dir in arrayOf(Direction.EAST, Direction.WEST, Direction.SOUTH, Direction.NORTH)) { for (dir in arrayOf(Direction.EAST, Direction.WEST, Direction.SOUTH, Direction.NORTH)) {
part().modelFile(down).rotationY(dir.yRotationBlockstateNorth()).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.UP).condition(EnergyCounterBlock.IF_DIRECTION, dir) part().modelFile(down).rotationY(dir.yRotationBlockstateNorth()).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.UP).condition(EnergyCounterBlock.IF_DIRECTION, dir)
@ -97,5 +92,4 @@ fun addComplexBlockStates(provider: MatteryBlockStateProvider) {
part().modelFile(mdl).rotationX(90).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.DOWN) part().modelFile(mdl).rotationX(90).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.DOWN)
} }
} }
}
} }

View File

@ -1,22 +1,19 @@
package ru.dbotthepony.mc.otm.datagen.blocks package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.core.Direction
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.RotatedPillarBlock
import net.minecraft.world.level.block.state.BlockState import net.minecraft.world.level.block.state.BlockState
import net.neoforged.neoforge.client.model.generators.BlockStateProvider import net.minecraftforge.client.model.generators.BlockStateProvider
import net.neoforged.neoforge.client.model.generators.ConfiguredModel import net.minecraftforge.client.model.generators.ConfiguredModel
import net.neoforged.neoforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.block.entity.WorkerState import ru.dbotthepony.mc.otm.block.entity.WorkerState
import ru.dbotthepony.mc.otm.util.getValueNullable import ru.dbotthepony.mc.otm.core.getValueNullable
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.xRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.* import java.util.LinkedList
typealias BlockStateTransform = (state: BlockState, builder: ConfiguredModel.Builder<*>, path: String) -> String? typealias BlockStateTransform = (state: BlockState, builder: ConfiguredModel.Builder<*>, path: String) -> String?
private val EMPTY: BlockStateTransform = { _, _, _ -> null } private val EMPTY: BlockStateTransform = { _, _, _ -> null }
@ -24,16 +21,16 @@ private val EMPTY: BlockStateTransform = { _, _, _ -> null }
private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String { private fun initialTransform(it: BlockState, modelPath: String, builder: ConfiguredModel.Builder<*>): String {
@Suppress("NAME_SHADOWING") var modelPath = modelPath @Suppress("NAME_SHADOWING") var modelPath = modelPath
it.getValueNullable(BlockRotationFreedom.HORIZONTAL.property)?.let { it.getValueNullable(BlockRotationFreedom.ONE.property)?.let {
builder.rotationY(it.front.yRotationBlockstateNorth()) builder.rotationY(it.front.yRotationBlockstateNorth())
} }
it.getValueNullable(BlockRotationFreedom.DIRECTIONAL.property)?.let { it.getValueNullable(BlockRotationFreedom.TWO.property)?.let {
builder.rotationY(it.front.yRotationBlockstateNorth()) builder.rotationY(it.front.yRotationBlockstateNorth())
builder.rotationX(it.front.xRotationBlockstateNorth()) builder.rotationX(it.front.xRotationBlockstateNorth())
} }
it.getValueNullable(BlockRotationFreedom.DIRECTIONAL_WITH_ROTATION.property)?.let { it.getValueNullable(BlockRotationFreedom.THREE.property)?.let {
builder.rotationY(it.front.yRotationBlockstateNorth() + it.top.yRotationBlockstateNorth()) builder.rotationY(it.front.yRotationBlockstateNorth() + it.top.yRotationBlockstateNorth())
builder.rotationX(it.front.xRotationBlockstateNorth()) builder.rotationX(it.front.xRotationBlockstateNorth())
} }
@ -57,10 +54,10 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
return this return this
} }
fun block(block: Block, model: String = "block/${block.registryName!!.path}", func: BlockStateTransform = EMPTY) = exec { fun block(block: Block, func: BlockStateTransform) = exec {
getVariantBuilder(block).forAllStates { getVariantBuilder(block).forAllStates {
val builder = ConfiguredModel.builder() val builder = ConfiguredModel.builder()
var modelPath = initialTransform(it, model, builder) var modelPath = initialTransform(it, "block/${block.registryName!!.path}", builder)
modelPath = func(it, builder, modelPath) ?: modelPath modelPath = func(it, builder, modelPath) ?: modelPath
builder.modelFile(models().getExistingFile(modLocation(modelPath))) builder.modelFile(models().getExistingFile(modLocation(modelPath)))
@ -71,7 +68,7 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
fun block(blocks: Collection<Block>): MatteryBlockStateProvider { fun block(blocks: Collection<Block>): MatteryBlockStateProvider {
for (block in blocks) { for (block in blocks) {
this.block(block) this.block(block, EMPTY)
} }
return this return this
@ -79,7 +76,7 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
fun block(vararg blocks: Block): MatteryBlockStateProvider { fun block(vararg blocks: Block): MatteryBlockStateProvider {
for (block in blocks) { for (block in blocks) {
block(block) this.block(block, EMPTY)
} }
return this return this
@ -87,33 +84,12 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
fun simpleBlockM(vararg blocks: Block): MatteryBlockStateProvider { fun simpleBlockM(vararg blocks: Block): MatteryBlockStateProvider {
for (block in blocks) { for (block in blocks) {
simpleBlockM(block)
}
return this
}
fun simpleBlockM(block: Block, model: ResourceLocation = checkNotNull(block.registryName) {"$block registry name is null!"}): MatteryBlockStateProvider {
exec { exec {
getVariantBuilder(block).forAllStates { getVariantBuilder(block).forAllStates {
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(model))) check(block.registryName != null) {"$block registry name is null!"}
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(block.registryName)))
} }
} }
return this
}
fun simplePillar(vararg blocks: Block): MatteryBlockStateProvider {
for (block in blocks) {
exec {
getVariantBuilder(block)
.partialState().with(RotatedPillarBlock.AXIS, Direction.Axis.Y)
.modelForState().modelFile(models().getExistingFile(block.registryName)).addModel()
.partialState().with(RotatedPillarBlock.AXIS, Direction.Axis.Z)
.modelForState().modelFile(models().getExistingFile(block.registryName)).rotationX(90).addModel()
.partialState().with(RotatedPillarBlock.AXIS, Direction.Axis.X)
.modelForState().modelFile(models().getExistingFile(block.registryName)).rotationX(90).rotationY(90).addModel()
}
} }
return this return this

View File

@ -1,16 +1,15 @@
package ru.dbotthepony.mc.otm.datagen.items package ru.dbotthepony.mc.otm.datagen.items
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import ru.dbotthepony.mc.otm.util.ResourceLocation import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
fun addItemModels(provider: MatteryItemModelProvider) { fun addItemModels(provider: MatteryItemModelProvider) {
provider.coloredWithBaseBlock(MItems.ANDROID_STATION, "android_station", "_working") provider.block(MItems.ANDROID_STATION, "android_station_working")
provider.coloredWithBaseBlock(MItems.BATTERY_BANK, "matter_capacitor_bank") provider.block(MItems.BATTERY_BANK)
provider.coloredWithBaseBlock(MItems.MATTER_CAPACITOR_BANK, "matter_capacitor_bank") provider.block(MItems.MATTER_CAPACITOR_BANK)
provider.block(MItems.PATTERN_STORAGE) provider.block(MItems.PATTERN_STORAGE)
provider.exec { provider.exec {
@ -21,36 +20,23 @@ fun addItemModels(provider: MatteryItemModelProvider) {
} }
provider.block(MItems.CARBON_FIBRE_BLOCK) provider.block(MItems.CARBON_FIBRE_BLOCK)
provider.block(MItems.METAL_JUNK, MItems.METAL_JUNK.registryName!!.path + "_a") provider.block(MItems.METAL_JUNK)
provider.block(MItems.METAL_MESH) provider.block(MItems.METAL_MESH)
provider.generatedTranslucent(MItems.TRITANIUM_BARS, modLocation("block/decorative/tritanium_bars")) provider.generatedTranslucent(MItems.TRITANIUM_BARS, modLocation("block/decorative/tritanium_bars"))
provider.generatedTranslucent(MItems.METAL_RAILING, modLocation("block/decorative/metal_railing"))
provider.blocks(MItems.TRITANIUM_STRIPED_BLOCK.values)
provider.coloredWithBaseBlock(MItems.ITEM_MONITOR, "item_monitor")
provider.block(MItems.PHANTOM_ATTRACTOR)
provider.block(MItems.HOLO_SIGN)
provider.block(MItems.TRITANIUM_ORE)
provider.block(MItems.DEEPSLATE_TRITANIUM_ORE) provider.block(MItems.DEEPSLATE_TRITANIUM_ORE)
provider.block(MItems.TRITANIUM_ORE)
provider.block(MItems.TRITANIUM_STRIPED_BLOCK)
provider.block(MItems.TRITANIUM_RAW_BLOCK) provider.block(MItems.TRITANIUM_RAW_BLOCK)
provider.block(MItems.TRITANIUM_INGOT_BLOCK) provider.block(MItems.TRITANIUM_INGOT_BLOCK)
provider.block(MItems.ITEM_MONITOR)
provider.block(MItems.WITHERED_STEEL_BLOCK) provider.block(MItems.PHANTOM_ATTRACTOR)
provider.block(MItems.ROFLITE_ALLOY_BLOCK) provider.block(MItems.HOLO_SIGN)
provider.generated(MItems.FLUID_CAPSULE)
provider.block(MItems.DILITHIUM_ORE) provider.block(MItems.FLUID_TANK)
provider.block(MItems.DEEPSLATE_DILITHIUM_ORE)
provider.block(MItems.DILITHIUM_CRYSTAL_BLOCK)
provider.withExistingParent(MItems.REDSTONE_LAMP_INVERTED, ResourceLocation("minecraft", "block/redstone_lamp_on"))
provider.withExistingParent(MItems.REINFORCED_REDSTONE_LAMP, modLocation("block/reinforced_redstone_lamp"))
provider.withExistingParent(MItems.REINFORCED_REDSTONE_LAMP_INVERTED, modLocation("block/reinforced_redstone_lamp_on"))
MRegistry.VENT.allItems.values.forEach(provider::block) MRegistry.VENT.allItems.values.forEach(provider::block)
MRegistry.VENT_ALTERNATIVE.allItems.values.forEach(provider::block) MRegistry.VENT_ALTERNATIVE.allItems.values.forEach(provider::block)
MRegistry.TRITANIUM_BLOCK.allItems.values.forEach(provider::block) MRegistry.TRITANIUM_BLOCK.allItems.values.forEach(provider::block)
MRegistry.COMPUTER_TERMINAL.allItems.values.forEach(provider::block)
MRegistry.STAR_CHAIR.allItems.values.forEach(provider::block)
MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach(provider::block) MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach(provider::block)
for (block in MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems) { for (block in MRegistry.TRITANIUM_STRIPED_BLOCK.flatItems) {
@ -69,10 +55,7 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.generated(MItems.PILL_HUMANE) provider.generated(MItems.PILL_HUMANE)
provider.generated(MItems.PILL_OBLIVION) provider.generated(MItems.PILL_OBLIVION)
provider.generated(MItems.PILL_HEAL) provider.generated(MItems.PILL_HEAL)
provider.generated(MItems.PILL_NOT_NORMAL)
provider.generated(MItems.NUTRIENT_PASTE) provider.generated(MItems.NUTRIENT_PASTE)
provider.generated(MItems.IMPERFECT_BREAD)
provider.generated(MItems.REDSTONE_INTERACTOR)
provider.generated(MItems.ESSENCE_DRIVE) provider.generated(MItems.ESSENCE_DRIVE)
provider.generated(MItems.ESSENCE_CAPSULE) provider.generated(MItems.ESSENCE_CAPSULE)
@ -94,112 +77,33 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.generated(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE) provider.generated(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE)
provider.generated(MItems.ExopackUpgrades.CRAFTING_UPGRADE) provider.generated(MItems.ExopackUpgrades.CRAFTING_UPGRADE)
provider.generated(MItems.ExopackUpgrades.SMELTING_UPGRADE)
provider.generated(MItems.ExopackUpgrades.ENDER_UPGRADE)
provider.resource(MItems.TRITANIUM_DUST) provider.component(MItems.TRITANIUM_DUST)
provider.resource(MItems.TRITANIUM_INGOT) provider.component(MItems.TRITANIUM_INGOT)
provider.resource(MItems.TRITANIUM_NUGGET) provider.component(MItems.TRITANIUM_NUGGET)
provider.resource(MItems.TRITANIUM_ORE_CLUMP) provider.resource(MItems.TRITANIUM_ORE_CLUMP)
provider.resource(MItems.DILITHIUM_CRYSTAL)
provider.resource(MItems.WITHERED_STEEL)
provider.resource(MItems.ROFLITE_ALLOY_INGOT)
provider.generated(MItems.EXOPACK_PROBE) provider.generated(MItems.EXOPACK_PROBE)
provider.handheld(MItems.TRITANIUM_TOOLS) provider.handheld(MItems.TRITANIUM_TOOLS)
provider.armorColored(MItems.TRITANIUM_ARMOR) provider.generated(MItems.TRITANIUM_ARMOR)
provider.armorWithTrims(MItems.SIMPLE_TRITANIUM_ARMOR) provider.generated(MItems.SIMPLE_TRITANIUM_ARMOR)
provider.handheld(MItems.CHEST_UPGRADER) provider.generatedTiered(MItems.BATTERIES, "battery_tier")
provider.exec {
val path = MItems.CONFIGURATOR.registryName!!.path
val ready = provider.withExistingParent("${path}_ready", MatteryItemModelProvider.HANDHELD)
.texture("layer0", modLocation("item/${path}_ready"))
provider.withExistingParent(path, MatteryItemModelProvider.HANDHELD)
.texture("layer0", modLocation("item/$path"))
.override().predicate(modLocation("has_configuration_saved"), 1f).model(ready).end()
}
provider.generated(MItems.BREAD_MONSTER_SPAWN_EGG, modLocation("item/egg/bread_monster"))
provider.generated(MItems.LOADER_SPAWN_EGG, modLocation("item/egg/loader"))
provider.capacitorWithGauge(MItems.BATTERY_CRUDE, 10, "battery_gauge_", modLocation("item/battery_tier0"))
provider.capacitorWithGauge(MItems.BATTERY_BASIC, 10, "battery_gauge_", modLocation("item/battery_tier1"))
provider.capacitorWithGauge(MItems.BATTERY_NORMAL, 10, "battery_gauge_", modLocation("item/battery_tier2"))
provider.capacitorWithGauge(MItems.BATTERY_DENSE, 10, "battery_gauge_", modLocation("item/battery_tier3"))
provider.capacitorWithGauge(MItems.BATTERY_CAPACITOR, 10, "battery_gauge_", modLocation("item/battery_tier4"))
provider.generated(MItems.BATTERY_CREATIVE) provider.generated(MItems.BATTERY_CREATIVE)
provider.capacitorWithGauge(MItems.PROCEDURAL_BATTERY, 9, "battery_procedural_gauge_", modLocation("item/battery_procedural"))
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_BASIC, 8, "matter_capacitor_gauge_", modLocation("item/matter_capacitor_tier1")) provider.generated(MItems.MATTER_CAPACITOR_BASIC, modLocation("item/matter_capacitor_tier1"))
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_NORMAL, 8, "matter_capacitor_gauge_", modLocation("item/matter_capacitor_tier2")) provider.generated(MItems.MATTER_CAPACITOR_NORMAL, modLocation("item/matter_capacitor_tier2"))
provider.capacitorWithGauge(MItems.MATTER_CAPACITOR_DENSE, 8, "matter_capacitor_gauge_", modLocation("item/matter_capacitor_tier3")) provider.generated(MItems.MATTER_CAPACITOR_DENSE, modLocation("item/matter_capacitor_tier3"))
provider.generated(MItems.MATTER_CAPACITOR_CREATIVE) provider.generated(MItems.MATTER_CAPACITOR_CREATIVE)
provider.generated(MItems.MachineUpgrades.Basic.BLANK, modLocation("item/machine_upgrade_tier1")) provider.generated(MItems.QUANTUM_BATTERY)
provider.upgrade(MItems.MachineUpgrades.Basic.SPEED, "speed", "tier1") provider.generated(MItems.QUANTUM_CAPACITOR)
provider.upgrade(MItems.MachineUpgrades.Basic.ENERGY_CONSUMPTION, "energy", "tier1")
provider.upgrade(MItems.MachineUpgrades.Basic.FAILSAFE, "failure", "tier1")
provider.upgrade(MItems.MachineUpgrades.Basic.ENERGY_STORAGE, "capacity", "tier1")
provider.upgrade(MItems.MachineUpgrades.Basic.MATTER_STORAGE, "matter", "tier1")
provider.upgrade(MItems.MachineUpgrades.Basic.PROCESSING_ITEMS, "processing", "tier1")
provider.generated(MItems.MachineUpgrades.Normal.BLANK, modLocation("item/machine_upgrade_tier2"))
provider.upgrade(MItems.MachineUpgrades.Normal.SPEED, "speed", "tier2")
provider.upgrade(MItems.MachineUpgrades.Normal.ENERGY_CONSUMPTION, "energy", "tier2")
provider.upgrade(MItems.MachineUpgrades.Normal.FAILSAFE, "failure", "tier2")
provider.upgrade(MItems.MachineUpgrades.Normal.ENERGY_STORAGE, "capacity", "tier2")
provider.upgrade(MItems.MachineUpgrades.Normal.MATTER_STORAGE, "matter", "tier2")
provider.upgrade(MItems.MachineUpgrades.Normal.PROCESSING_ITEMS, "processing", "tier2")
provider.generated(MItems.MachineUpgrades.Advanced.BLANK, modLocation("item/machine_upgrade_tier3"))
provider.upgrade(MItems.MachineUpgrades.Advanced.SPEED, "speed", "tier3")
provider.upgrade(MItems.MachineUpgrades.Advanced.ENERGY_CONSUMPTION, "energy", "tier3")
provider.upgrade(MItems.MachineUpgrades.Advanced.FAILSAFE, "failure", "tier3")
provider.upgrade(MItems.MachineUpgrades.Advanced.ENERGY_STORAGE, "capacity", "tier3")
provider.upgrade(MItems.MachineUpgrades.Advanced.MATTER_STORAGE, "matter", "tier3")
provider.upgrade(MItems.MachineUpgrades.Advanced.PROCESSING_ITEMS, "processing", "tier3")
provider.upgrade(MItems.MachineUpgrades.Creative.SPEED, "speed", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.ENERGY_CONSUMPTION, "energy", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.ENERGY_THROUGHPUT, "energy", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.ENERGY_THROUGHPUT_FLAT, "energy", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.ENERGY_THROUGHPUT_FLAT_SMALL, "energy", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.ENERGY_STORAGE, "capacity", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.ENERGY_STORAGE_FLAT, "capacity", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.ENERGY_STORAGE_FLAT_SMALL, "capacity", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.FAILSAFE, "failure", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.FAILURE, "failure", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.PROCESSING_ITEMS, "processing", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.MATTER_STORAGE, "matter", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.MATTER_STORAGE_FLAT, "matter", "creative")
provider.upgrade(MItems.MachineUpgrades.Creative.MATTER_STORAGE_FLAT_SMALL, "matter", "creative")
provider.capacitorWithGauge(MItems.QUANTUM_BATTERY, 10, "battery_gauge_")
provider.capacitorWithGauge(MItems.QUANTUM_CAPACITOR, 10, "battery_gauge_")
provider.generated(MItems.QUANTUM_BATTERY_CREATIVE) provider.generated(MItems.QUANTUM_BATTERY_CREATIVE)
provider.generated(MItems.PATTERN_DRIVE_NORMAL, modLocation("item/pattern_drive_tier1"))
provider.generated(MItems.PATTERN_DRIVE_DOUBLE, modLocation("item/pattern_drive_tier2"))
provider.generated(MItems.PATTERN_DRIVE_TRIPLE, modLocation("item/pattern_drive_tier3"))
provider.generated(MItems.PATTERN_DRIVE_QUAD, modLocation("item/pattern_drive_tier4"))
provider.generated(MItems.PATTERN_DRIVE_CREATIVE) provider.generated(MItems.PATTERN_DRIVE_CREATIVE)
provider.generated(MItems.PATTERN_DRIVE_CREATIVE2) provider.generated(MItems.PATTERN_DRIVE_CREATIVE2)
provider.withExistingParent(MItems.GOLD_DISK, MItems.PATTERN_DRIVE_CREATIVE.registryName!!)
provider.generated(MItems.MATTER_DUST) provider.generated(MItems.MATTER_DUST)
provider.generated(MItems.TRITANIUM_DOOR.values) provider.generated(MItems.TRITANIUM_DOOR.values)
@ -207,88 +111,36 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.block(MItems.TRITANIUM_TRAPDOOR[null]!!, "tritanium_trapdoor_bottom") provider.block(MItems.TRITANIUM_TRAPDOOR[null]!!, "tritanium_trapdoor_bottom")
for (color in DyeColor.entries) for (color in DyeColor.values())
provider.block(MItems.TRITANIUM_TRAPDOOR[color]!!, "tritanium_trapdoor_${color.name.lowercase()}_bottom") provider.block(MItems.TRITANIUM_TRAPDOOR[color]!!, "tritanium_trapdoor_${color.name.lowercase()}_bottom")
for (item in MRegistry.CARGO_CRATES.allItems.values) for (item in MRegistry.CARGO_CRATES.allItems.values) {
provider.block(item, "${item.registryName!!.path}_closed") provider.block(item, "${item.registryName!!.path}_closed")
provider.coloredWithBaseBlock(MItems.CHEMICAL_GENERATOR, "chemical_generator", "_working")
provider.coloredWithBaseBlock(MItems.ENERGY_COUNTER, "energy_counter_down")
provider.coloredWithBaseBlock(MItems.MATTER_BOTTLER, "matter_bottler", "_idle")
provider.coloredWithBaseBlock(MItems.MATTER_SCANNER, "matter_scanner", "_idle")
provider.coloredWithBaseBlock(MItems.MATTER_REPLICATOR, "matter_replicator", "_idle")
provider.block(MItems.MATTER_ENTANGLER, "matter_entangler_idle")
provider.coloredWithBaseBlock(MItems.DRIVE_VIEWER, "drive_viewer", "_idle")
provider.coloredWithBaseBlock(MItems.MATTER_DECOMPOSER, "matter_decomposer", "_idle")
provider.coloredWithBaseBlock(MItems.ENERGY_SERVO, "energy_servo")
provider.coloredWithBaseBlock(MItems.MATTER_RECONSTRUCTOR, "matter_reconstructor")
provider.coloredWithBaseBlock(MItems.POWERED_BLAST_FURNACE, "powered_blast_furnace", "_idle")
provider.coloredWithBaseBlock(MItems.POWERED_FURNACE, "powered_furnace", "_idle")
provider.coloredWithBaseBlock(MItems.POWERED_SMOKER, "powered_smoker", "_idle")
provider.coloredWithBaseBlock(MItems.PLATE_PRESS, "plate_press", "_idle")
provider.coloredWithBaseBlock(MItems.TWIN_PLATE_PRESS, "twin_plate_press", "_idle")
provider.coloredWithBaseBlock(MItems.STORAGE_POWER_SUPPLIER, "storage_power_supplier")
provider.coloredWithBaseBlock(MItems.MATTER_RECYCLER, "matter_recycler", "_idle")
provider.coloredWithBaseBlock(MItems.COBBLESTONE_GENERATOR, "cobblestone_generator")
provider.block(MItems.PAINTER, "painter")
provider.block(MItems.INFINITE_WATER_SOURCE, "infinite_water_source")
provider.exec {
provider.withExistingParent("essence_storage", modLocation("block/essence_storage_empty"))
.override()
.predicate(modLocation("is_filled"), 1f)
.model(provider.withExistingParent("essence_storage_filled", modLocation("block/essence_storage_filled")))
.end()
} }
for (dye in DyeColor.entries) { provider.block(MItems.CHEMICAL_GENERATOR, "chemical_generator_working")
provider.exec { provider.block(MItems.ENERGY_COUNTER, "energy_counter_down")
provider.withExistingParent("android_charger_${dye.name.lowercase()}", modLocation("item/android_charger")).texture("0", modLocation("block/android_charger/${dye.name.lowercase()}")) provider.block(MItems.MATTER_BOTTLER, "matter_bottler_working")
provider.withExistingParent("matter_panel_${dye.name.lowercase()}", modLocation("item/matter_panel")).texture("texture", modLocation("block/matter_panel/${dye.name.lowercase()}")) provider.block(MItems.MATTER_CABLE, "matter_cable_core")
provider.withExistingParent("essence_storage_${dye.name.lowercase()}", modLocation("block/essence_storage_${dye.name.lowercase()}_empty")) provider.block(MItems.MATTER_DECOMPOSER, "matter_decomposer_working")
.override() provider.block(MItems.ENERGY_SERVO, "energy_servo")
.predicate(modLocation("is_filled"), 1f) provider.block(MItems.ESSENCE_STORAGE, "essence_storage")
.model(provider.withExistingParent("essence_storage_${dye.name.lowercase()}_filled", modLocation("block/essence_storage_${dye.name.lowercase()}_filled"))) provider.block(MItems.MATTER_RECONSTRUCTOR, "matter_reconstructor")
.end()
} provider.block(MItems.PLATE_PRESS, "plate_press_idle")
} provider.block(MItems.STORAGE_POWER_SUPPLIER, "storage_power_supplier")
provider.block(MItems.MATTER_RECYCLER, "matter_recycler_working")
provider.block(MItems.COBBLESTONE_GENERATOR, "cobblestone_generator")
provider.block(MItems.STORAGE_BUS) provider.block(MItems.STORAGE_BUS)
provider.block(MItems.STORAGE_IMPORTER) provider.block(MItems.STORAGE_IMPORTER)
provider.block(MItems.STORAGE_EXPORTER) provider.block(MItems.STORAGE_EXPORTER)
provider.block(MItems.FLYWHEEL_HOUSING) for (item in MItems.TRITANIUM_ANVIL) {
provider.block(MItems.FLYWHEEL_BEARING) provider.block(item)
provider.block(MItems.FLYWHEEL_SHAFT) }
provider.block(MItems.FLYWHEEL_BATTERY)
provider.block(MItems.TRITANIUM_HULL)
provider.block(MItems.GENERATOR_BLOCK)
provider.block(MItems.ENERGY_INPUT_INTERFACE)
provider.block(MItems.ENERGY_OUTPUT_INTERFACE)
provider.block(MItems.ENERGY_INPUT_HATCH)
provider.block(MItems.ENERGY_OUTPUT_HATCH)
provider.block(MItems.MATTER_INPUT_HATCH)
provider.block(MItems.MATTER_OUTPUT_HATCH)
provider.block(MItems.ITEM_INPUT_HATCH)
provider.block(MItems.ITEM_OUTPUT_HATCH)
provider.block(MItems.MODULAR_FRAME)
provider.block(MItems.HEAVY_MODULAR_FRAME)
MItems.TRITANIUM_ANVIL.values.forEach { provider.blocks(it) }
for ((color, item) in MItems.CARGO_CRATE_MINECARTS) { for ((color, item) in MItems.CARGO_CRATE_MINECARTS) {
provider.generated(item) provider.generated(item)
} }
MItems.SUSPICIOUS_FOODS.ITEMS.forEach { provider.inherit(it, it.mimicking()) }
} }

View File

@ -1,17 +1,12 @@
package ru.dbotthepony.mc.otm.datagen.items package ru.dbotthepony.mc.otm.datagen.items
import net.minecraft.data.models.ItemModelGenerators
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.server.packs.PackType
import net.minecraft.world.item.ArmorItem
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.neoforged.neoforge.client.model.generators.ItemModelProvider import net.minecraftforge.client.model.generators.ItemModelProvider
import net.neoforged.neoforge.data.event.GatherDataEvent import net.minecraftforge.data.event.GatherDataEvent
import org.apache.logging.log4j.LogManager import org.apache.logging.log4j.LogManager
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.LinkedList import java.util.LinkedList
@ -31,29 +26,6 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
fun block(item: Item) = exec { withExistingParent(item.registryName!!.path, modLocation("block/${item.registryName!!.path}")) } fun block(item: Item) = exec { withExistingParent(item.registryName!!.path, modLocation("block/${item.registryName!!.path}")) }
fun block(item: Item, path: String) = exec { withExistingParent(item.registryName!!.path, modLocation("block/$path")) } fun block(item: Item, path: String) = exec { withExistingParent(item.registryName!!.path, modLocation("block/$path")) }
fun withExistingParent(item: Item, path: ResourceLocation) = exec { withExistingParent(item.registryName!!.path, path) }
fun inherit(item: Item, parent: Item) {
exec { withExistingParent(item.registryName!!.path, parent.registryName!!) }
}
fun coloredWithBaseBlock(items: Map<DyeColor?, Item>, path: String) {
for (color in DyeColor.entries) {
block(items[color]!!, path + "_${color.name.lowercase()}")
}
block(items[null]!!, path)
}
fun coloredWithBaseBlock(items: Map<DyeColor?, Item>, path: String, suffix: String) {
for (color in DyeColor.entries) {
block(items[color]!!, path + "_${color.name.lowercase()}$suffix")
}
block(items[null]!!, path + suffix)
}
fun blocks(vararg items: Item) = items.forEach(this::block) fun blocks(vararg items: Item) = items.forEach(this::block)
fun blocks(items: Collection<Item>) = items.forEach(this::block) fun blocks(items: Collection<Item>) = items.forEach(this::block)
@ -106,72 +78,7 @@ class MatteryItemModelProvider(event: GatherDataEvent) : ItemModelProvider(event
} }
} }
fun armorWithTrims(item: Item, texture: ResourceLocation) = exec {
val mainModel = withExistingParent(item.registryName!!.path, GENERATED).texture("layer0", texture)
if (item is ArmorItem) {
for ((i, material) in ARMOR_TRIM_MATERIALS.withIndex()) {
val trimLocation = ResourceLocation.withDefaultNamespace("trims/items/${item.type.getName()}_trim_${material}")
existingFileHelper.trackGenerated(trimLocation, PackType.CLIENT_RESOURCES, ".png", "textures")
val overrideModel = withExistingParent("${item.registryName!!.path}_${material}_trim", GENERATED)
.texture("layer0", texture)
.texture("layer1", trimLocation)
mainModel.override()
.predicate(ItemModelGenerators.TRIM_TYPE_PREDICATE_ID, (i + 1).toFloat() / ARMOR_TRIM_MATERIALS.size.toFloat())
.model(overrideModel)
.end()
}
}
}
fun armorWithTrims(vararg items: Item) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
fun armorWithTrims(items: Collection<Item>) = items.forEach { armorWithTrims(it, modLocation("item/${it.registryName!!.path}")) }
fun armorColored(item: Item) = exec {
withExistingParent(item.registryName!!.path, GENERATED)
.texture("layer0", modLocation("item/${item.registryName!!.path}_base"))
.texture("layer1", modLocation("item/${item.registryName!!.path}_overlay"))
}
fun armorColored(vararg items: Item) = items.forEach { armorColored(it) }
fun armorColored(items: Collection<Item>) = items.forEach { armorColored(it) }
fun upgrade(item: Item, upgradeType: String, tier: String = "tier0") = exec {
withExistingParent(item.registryName!!.path, GENERATED)
.texture("layer0", modLocation("item/machine_upgrade_$tier"))
.texture("layer1", modLocation("item/machine_upgrade_icon_$upgradeType"))
}
fun capacitorWithGauge(item: Item, fillTextures: Int, gaugePrefix: String, baseTexture: ResourceLocation? = null) = exec {
val path = item.registryName!!.path
val texture = baseTexture ?: modLocation("item/$path")
val empty = withExistingParent("${path}_empty", GENERATED)
.texture("layer0", texture)
val basic = withExistingParent(path, GENERATED)
.texture("layer0", texture)
.texture("layer1", modLocation("item/${gaugePrefix}$fillTextures"))
.override()
.predicate(modLocation("capacitor_gauge"), 0f)
.model(empty)
.end()
for (i in 1 .. fillTextures) {
val model = withExistingParent("${path}_fill_$i", GENERATED)
.texture("layer0", texture)
.texture("layer1", modLocation("item/${gaugePrefix}$i"))
basic.override()
.predicate(modLocation("capacitor_gauge"), i.toFloat() / fillTextures.toFloat())
.model(model)
.end()
}
}
companion object { companion object {
val ARMOR_TRIM_MATERIALS = listOf("quartz", "iron", "netherite", "redstone", "copper", "gold", "emerald", "diamond", "lapis", "amethyst")
val GENERATED = ResourceLocation("minecraft", "item/generated") val GENERATED = ResourceLocation("minecraft", "item/generated")
val HANDHELD = ResourceLocation("minecraft", "item/handheld") val HANDHELD = ResourceLocation("minecraft", "item/handheld")
private val LOGGER = LogManager.getLogger() private val LOGGER = LogManager.getLogger()

View File

@ -1,20 +1,12 @@
package ru.dbotthepony.mc.otm.datagen.lang package ru.dbotthepony.mc.otm.datagen.lang
import ru.dbotthepony.mc.otm.config.CablesConfig
import ru.dbotthepony.mc.otm.registry.* import ru.dbotthepony.mc.otm.registry.*
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.game.MEntityTypes
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
private fun decoratives(provider: MatteryLanguageProvider) { private fun decoratives(provider: MatteryLanguageProvider) {
with(provider.englishColors) { with(provider.englishColors) {
add(MRegistry.VENT, "%s Vent") add(MRegistry.VENT, "%s Vent")
add(MRegistry.VENT_ALTERNATIVE, "%s Alternative Vent") add(MRegistry.VENT_ALTERNATIVE, "%s Alternative Vent")
add(MRegistry.COMPUTER_TERMINAL, "%s Computer Terminal")
add(MRegistry.STAR_CHAIR, "%s Star Chair")
add(MRegistry.TRITANIUM_BLOCK, "%s Tritanium Block") add(MRegistry.TRITANIUM_BLOCK, "%s Tritanium Block")
add(MRegistry.TRITANIUM_STAIRS, "%s Tritanium Stairs") add(MRegistry.TRITANIUM_STAIRS, "%s Tritanium Stairs")
add(MRegistry.TRITANIUM_SLAB, "%s Tritanium Slab") add(MRegistry.TRITANIUM_SLAB, "%s Tritanium Slab")
@ -32,7 +24,7 @@ private fun decoratives(provider: MatteryLanguageProvider) {
} }
with (provider.english) { with (provider.english) {
for ((color, name) in provider.englishColors.mapped) { for ((color, name) in provider.englishColors.dyeClassMapped) {
add(MItems.CARGO_CRATE_MINECARTS[color]!!, "Minecart with $name Cargo Crate") add(MItems.CARGO_CRATE_MINECARTS[color]!!, "Minecart with $name Cargo Crate")
add(MEntityTypes.CARGO_CRATE_MINECARTS[color]!!, "Minecart with $name Cargo Crate") add(MEntityTypes.CARGO_CRATE_MINECARTS[color]!!, "Minecart with $name Cargo Crate")
@ -49,8 +41,6 @@ private fun decoratives(provider: MatteryLanguageProvider) {
add(MBlocks.TRITANIUM_TRAPDOOR[color]!!, "description0", "High blast resistance door with redstone latch...") add(MBlocks.TRITANIUM_TRAPDOOR[color]!!, "description0", "High blast resistance door with redstone latch...")
add(MBlocks.TRITANIUM_TRAPDOOR[color]!!, "description1", "...feeling safe now?") add(MBlocks.TRITANIUM_TRAPDOOR[color]!!, "description1", "...feeling safe now?")
add(MBlocks.TRITANIUM_TRAPDOOR[color]!!, "description2", "This one is painted $name") add(MBlocks.TRITANIUM_TRAPDOOR[color]!!, "description2", "This one is painted $name")
add(MBlocks.GRILL[color]!!, "$name Briefcase Grill")
} }
add(MRegistry.TRITANIUM_PRESSURE_PLATE.block, "Tritanium Pressure Plate") add(MRegistry.TRITANIUM_PRESSURE_PLATE.block, "Tritanium Pressure Plate")
@ -58,27 +48,11 @@ private fun decoratives(provider: MatteryLanguageProvider) {
add(MRegistry.TRITANIUM_PRESSURE_PLATE.block, "description1", "High blast resistance") add(MRegistry.TRITANIUM_PRESSURE_PLATE.block, "description1", "High blast resistance")
} }
with(provider.englishColors) {
addIntermediate(MBlocks.TRITANIUM_STRIPED_BLOCK, "Tritanium %s Striped Block")
addIntermediate(MBlocks.TRITANIUM_STRIPED_STAIRS, "Tritanium %s Striped Stairs")
addIntermediate(MBlocks.TRITANIUM_STRIPED_SLAB, "Tritanium %s Striped Slab")
addIntermediate(MBlocks.TRITANIUM_STRIPED_WALL, "Tritanium %s Striped Wall")
}
with(provider.english) { with(provider.english) {
misc("computer_terminal_tooltip", "Can be used as Redstone button, except it sends signal to block behind it, not under")
misc("computer_terminal_tooltip1", "To setup how long it sends redstone signal, interact with it while sneaking")
misc("decorative", "Decorative")
add(MItems.CARGO_CRATE_MINECARTS[null]!!, "Minecart with Cargo Crate") add(MItems.CARGO_CRATE_MINECARTS[null]!!, "Minecart with Cargo Crate")
add(MEntityTypes.CARGO_CRATE_MINECARTS[null]!!, "Minecart with Cargo Crate") add(MEntityTypes.CARGO_CRATE_MINECARTS[null]!!, "Minecart with Cargo Crate")
add(MBlocks.GRILL[null]!!, "Briefcase Grill")
add(MRegistry.CARGO_CRATES.block, "Cargo Crate") add(MRegistry.CARGO_CRATES.block, "Cargo Crate")
add(MRegistry.COMPUTER_TERMINAL.block, "Computer Terminal")
add(MRegistry.STAR_CHAIR.block, "Star Chair")
add(MRegistry.STAR_CHAIR.block, "desc", "For extensive stargazing.")
add(MRegistry.TRITANIUM_BLOCK.block, "Tritanium Block") add(MRegistry.TRITANIUM_BLOCK.block, "Tritanium Block")
add(MRegistry.TRITANIUM_STAIRS.block, "Tritanium Stairs") add(MRegistry.TRITANIUM_STAIRS.block, "Tritanium Stairs")
add(MRegistry.TRITANIUM_SLAB.block, "Tritanium Slab") add(MRegistry.TRITANIUM_SLAB.block, "Tritanium Slab")
@ -92,11 +66,12 @@ private fun decoratives(provider: MatteryLanguageProvider) {
add(MRegistry.VENT.block, "Vent") add(MRegistry.VENT.block, "Vent")
add(MRegistry.VENT_ALTERNATIVE.block, "Alternative Vent") add(MRegistry.VENT_ALTERNATIVE.block, "Alternative Vent")
for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) { for ((block, colors) in MRegistry.TRITANIUM_STRIPED_BLOCK.blocksWithColor) {
val (base, stripe) = colors val (base, stripe) = colors
val baseName = provider.englishColors.mapped[base]!! val baseName = provider.englishColors.dyeClassMapped[base]!!
val stripeName = provider.englishColors.mapped[stripe]!! val stripeName = provider.englishColors.dyeClassMapped[stripe]!!
add(block, "$baseName Colored $stripeName Striped Tritanium Block") add(block, "$baseName Colored $stripeName Striped Tritanium Block")
} }
@ -104,8 +79,8 @@ private fun decoratives(provider: MatteryLanguageProvider) {
for ((block, colors) in MRegistry.TRITANIUM_STRIPED_STAIRS.blocksWithColor) { for ((block, colors) in MRegistry.TRITANIUM_STRIPED_STAIRS.blocksWithColor) {
val (base, stripe) = colors val (base, stripe) = colors
val baseName = provider.englishColors.mapped[base]!! val baseName = provider.englishColors.dyeClassMapped[base]!!
val stripeName = provider.englishColors.mapped[stripe]!! val stripeName = provider.englishColors.dyeClassMapped[stripe]!!
add(block, "$baseName Colored $stripeName Striped Tritanium Stairs") add(block, "$baseName Colored $stripeName Striped Tritanium Stairs")
} }
@ -113,8 +88,8 @@ private fun decoratives(provider: MatteryLanguageProvider) {
for ((block, colors) in MRegistry.TRITANIUM_STRIPED_SLAB.blocksWithColor) { for ((block, colors) in MRegistry.TRITANIUM_STRIPED_SLAB.blocksWithColor) {
val (base, stripe) = colors val (base, stripe) = colors
val baseName = provider.englishColors.mapped[base]!! val baseName = provider.englishColors.dyeClassMapped[base]!!
val stripeName = provider.englishColors.mapped[stripe]!! val stripeName = provider.englishColors.dyeClassMapped[stripe]!!
add(block, "$baseName Colored $stripeName Striped Tritanium Slab") add(block, "$baseName Colored $stripeName Striped Tritanium Slab")
} }
@ -122,8 +97,8 @@ private fun decoratives(provider: MatteryLanguageProvider) {
for ((block, colors) in MRegistry.TRITANIUM_STRIPED_WALL.blocksWithColor) { for ((block, colors) in MRegistry.TRITANIUM_STRIPED_WALL.blocksWithColor) {
val (base, stripe) = colors val (base, stripe) = colors
val baseName = provider.englishColors.mapped[base]!! val baseName = provider.englishColors.dyeClassMapped[base]!!
val stripeName = provider.englishColors.mapped[stripe]!! val stripeName = provider.englishColors.dyeClassMapped[stripe]!!
add(block, "$baseName Colored $stripeName Striped Tritanium Wall") add(block, "$baseName Colored $stripeName Striped Tritanium Wall")
} }
@ -135,9 +110,6 @@ private fun sounds(provider: MatteryLanguageProvider) {
sound("rifle_shot", "Plasma rifle fires") sound("rifle_shot", "Plasma rifle fires")
sound("plasma_weapon_overheat", "Plasma weapon overheats") sound("plasma_weapon_overheat", "Plasma weapon overheats")
sound("player_become_android", "Player became android") sound("player_become_android", "Player became android")
sound("projectile_parry", "Projectile parried")
sound("jump_boost", "Jump boost")
sound("shockwave", "Landing shockwave")
sound(MSoundEvents.CARGO_CRATE_OPEN, "Cargo crate opened") sound(MSoundEvents.CARGO_CRATE_OPEN, "Cargo crate opened")
} }
@ -145,59 +117,11 @@ private fun sounds(provider: MatteryLanguageProvider) {
private fun misc(provider: MatteryLanguageProvider) { private fun misc(provider: MatteryLanguageProvider) {
with(provider.english) { with(provider.english) {
misc("misc.inert", "Inert")
misc("misc.yes", "Yes")
misc("misc.no", "No")
misc("pwr_alert1", "[%s]")
misc("pwr_alert2", "PWR: ALERT")
misc("pwr_alert3", "WARNING ERROR:")
misc("pwr_alert4", "system_crash_log")
// Error 06E has occurred at 0027F:C0082E2270273 in VXE VMMXDE
// Error <Code> has occurred at <Server Block>:<RAM Address> in <Register?>
misc("pwr_alert5", "Error %s has occurred at %s:%s in %s")
gui("double_processing", "Processes two items at once")
misc("painted.black", "Painted Black")
misc("painted.blue", "Painted Blue")
misc("painted.brown", "Painted Brown")
misc("painted.cyan", "Painted Cyan")
misc("painted.gray", "Painted Gray")
misc("painted.green", "Painted Green")
misc("painted.light_blue", "Painted Light Blue")
misc("painted.light_gray", "Painted Light Gray")
misc("painted.lime", "Painted Lime")
misc("painted.magenta", "Painted Magenta")
misc("painted.orange", "Painted Orange")
misc("painted.pink", "Painted Pink")
misc("painted.purple", "Painted Purple")
misc("painted.red", "Painted Red")
misc("painted.white", "Painted White")
misc("painted.yellow", "Painted Yellow")
gui("shift_for_more_info", "<Hold SHIFT for more info>")
gui("help.slot_filters", "Hold CTRL to setup slot filters")
gui("help.slot_charging", "Hold ALT to switch slot charging")
gui("needs", "Needs %s")
gui("needs_x", "Needs %s x%d")
misc("needs_no_power", "Requires no power to operate") misc("needs_no_power", "Requires no power to operate")
gui("lock_holo_screen", "Lock contents") gui("lock_holo_screen", "Lock contents")
gui("lock_holo_screen.unlocked", "Unlock contents")
gui("lock_holo_screen.tip", "Locking and unlocking contents is only possible in creative.\nWhen locked, text boundaries are removed.") gui("lock_holo_screen.tip", "Locking and unlocking contents is only possible in creative.\nWhen locked, text boundaries are removed.")
gui("holo_screen.resize_text", "Resize text automatically")
gui("holo_screen.do_not_resize_text", "Do not resize text")
gui("abc", "ABC")
gui("use_standard_font", "Use standard font")
gui("use_small_font", "Use small font")
gui("ticks", "Ticks") gui("ticks", "Ticks")
gui("power_cost_per_use", "Power cost per use: %s") gui("power_cost_per_use", "Power cost per use: %s")
@ -209,19 +133,9 @@ private fun misc(provider: MatteryLanguageProvider) {
gui("recipe.ticks", "%s Ticks") gui("recipe.ticks", "%s Ticks")
gui("exopack", "Exopack Inventory") gui("exopack", "Exopack Inventory")
gui("exopack.customize", "Customize Exopack appearance")
gui("exopack.customization", "Exopack appearance settings")
gui("exopack.go_back", "Open vanilla inventory") gui("exopack.go_back", "Open vanilla inventory")
gui("exopack.go_in", "Open Exopack inventory") gui("exopack.go_in", "Open Exopack inventory")
gui("exopack.toggle_visibility", "Visibile on player") gui("exopack.toggle_visibility", "Toggle Exopack visibility")
gui("exopack.toggle_glow", "Glows in dark")
gui("exopack.change_color", "Customize color")
gui("exopack.change_color2", "Remove color")
gui("exopack.go_curios", "Open Curios inventory")
gui("change_color", "Customize color")
gui("exopack.probe1", "This little device feels unnatural to touch, it is almost certainly resilient to any possible attempt to break it open.") gui("exopack.probe1", "This little device feels unnatural to touch, it is almost certainly resilient to any possible attempt to break it open.")
gui("exopack.probe2", "There is fingerprint reader built into one of sides which gently glow when touched.") gui("exopack.probe2", "There is fingerprint reader built into one of sides which gently glow when touched.")
@ -234,8 +148,6 @@ private fun misc(provider: MatteryLanguageProvider) {
gui("exopack_upgrades.already_activated", "Upgrade is already active!") gui("exopack_upgrades.already_activated", "Upgrade is already active!")
gui("exopack_upgrades.slots_upgrade", "Using this will permanently grant %s slots in your Exopack inventory.") gui("exopack_upgrades.slots_upgrade", "Using this will permanently grant %s slots in your Exopack inventory.")
gui("exopack_upgrades.crafting_upgrade", "Using this will permanently grant 3x3 crafting grid in your Exopack inventory.") gui("exopack_upgrades.crafting_upgrade", "Using this will permanently grant 3x3 crafting grid in your Exopack inventory.")
gui("exopack_upgrades.smelting_upgrade", "Using this will permanently grant smelter in your Exopack inventory.")
gui("exopack_upgrades.ender_access_upgrade", "Using this will permanently grant Ender Chest access in your Exopack inventory.")
gui("crude_battery.replace_in_world", "Simplistic nature of this battery allows to replace your energy source in the field without using Android Station.") gui("crude_battery.replace_in_world", "Simplistic nature of this battery allows to replace your energy source in the field without using Android Station.")
gui("crude_battery.replace_in_world_warning", "This operation is very unstable and can cause extreme damage to your systems!") gui("crude_battery.replace_in_world_warning", "This operation is very unstable and can cause extreme damage to your systems!")
@ -246,8 +158,6 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("exopack_upgrades.slots_upgraded", "Your Exopack has permanently gained %s slots") misc("exopack_upgrades.slots_upgraded", "Your Exopack has permanently gained %s slots")
misc("exopack_upgrades.crafting_upgraded", "Your Exopack has permanently gained 3x3 crafting grid") misc("exopack_upgrades.crafting_upgraded", "Your Exopack has permanently gained 3x3 crafting grid")
misc("exopack_upgrades.smelting_installed", "Your Exopack has permanently gained smelting module")
misc("exopack_upgrades.ender_access_installed", "Your Exopack has permanently gained access to Ender Chest contents")
misc("exopack.granted1", "As you keep pressing on the fingerprint reader, probe disappears.") misc("exopack.granted1", "As you keep pressing on the fingerprint reader, probe disappears.")
misc("exopack.granted2", "After a moment, you are getting pierced into back multiple times...") misc("exopack.granted2", "After a moment, you are getting pierced into back multiple times...")
@ -276,8 +186,6 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("suffix.exa", "%s E%s") misc("suffix.exa", "%s E%s")
misc("suffix.zetta", "%s Z%s") misc("suffix.zetta", "%s Z%s")
misc("suffix.yotta", "%s Y%s") misc("suffix.yotta", "%s Y%s")
misc("suffix.ronna", "%s R%s")
misc("suffix.quetta", "%s Q%s")
misc("suffix.deci", "%s d%s") misc("suffix.deci", "%s d%s")
misc("suffix.centi", "%s c%s") misc("suffix.centi", "%s c%s")
@ -290,29 +198,6 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("suffix.zepto", "%s z%s") misc("suffix.zepto", "%s z%s")
misc("suffix.yocto", "%s y%s") misc("suffix.yocto", "%s y%s")
misc("suffix_concise.none", "%s")
misc("suffix_concise.kilo", "%sk")
misc("suffix_concise.mega", "%sM")
misc("suffix_concise.giga", "%sG")
misc("suffix_concise.tera", "%sT")
misc("suffix_concise.peta", "%sP")
misc("suffix_concise.exa", "%sE")
misc("suffix_concise.zetta", "%sZ")
misc("suffix_concise.yotta", "%sY")
misc("suffix_concise.ronna", "%sR")
misc("suffix_concise.quetta", "%sQ")
misc("suffix_concise.deci", "%sd")
misc("suffix_concise.centi", "%sc")
misc("suffix_concise.milli", "%sm")
misc("suffix_concise.micro", "%sμ")
misc("suffix_concise.nano", "%sn")
misc("suffix_concise.pico", "%sp")
misc("suffix_concise.femto", "%sf")
misc("suffix_concise.atto", "%sa")
misc("suffix_concise.zepto", "%sz")
misc("suffix_concise.yocto", "%sy")
misc("suffix_raw.kilo", "k") misc("suffix_raw.kilo", "k")
misc("suffix_raw.mega", "M") misc("suffix_raw.mega", "M")
misc("suffix_raw.giga", "G") misc("suffix_raw.giga", "G")
@ -321,9 +206,6 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("suffix_raw.exa", "E") misc("suffix_raw.exa", "E")
misc("suffix_raw.zetta", "Z") misc("suffix_raw.zetta", "Z")
misc("suffix_raw.yotta", "Y") misc("suffix_raw.yotta", "Y")
misc("suffix_raw.ronna", "R")
misc("suffix_raw.quetta", "Q")
misc("suffix_raw.deci", "d") misc("suffix_raw.deci", "d")
misc("suffix_raw.centi", "c") misc("suffix_raw.centi", "c")
misc("suffix_raw.milli", "m") misc("suffix_raw.milli", "m")
@ -343,15 +225,10 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("item.power.last_20_ticks", "Last second: %s") misc("item.power.last_20_ticks", "Last second: %s")
misc("item.power.last_tick", "Last tick: %s") misc("item.power.last_tick", "Last tick: %s")
gui("power.passed", "Total passed energy:")
gui("power.average", "Average throughput per tick:")
gui("power.last_20_ticks", "Last second:")
gui("power.last_tick", "Last tick:")
misc("item.power.storage", "Stored energy: %s / %s") misc("item.power.storage", "Stored energy: %s / %s")
misc("item.power.storage0", "Stored energy: %s")
misc("item.power.throughput", "Max I/O: %s / %s") misc("item.power.throughput", "Max I/O: %s / %s")
misc("item.power.throughput_mono", "Max I/O: %s") misc("item.power.throughput_mono", "Max I/O: %s")
misc("item.power.infinity", "∞ MtJ")
misc("item.worker.work_ticks_mono", "Work ticks: %s") misc("item.worker.work_ticks_mono", "Work ticks: %s")
misc("item.worker.work_ticks", "Work ticks: %s / %s") misc("item.worker.work_ticks", "Work ticks: %s / %s")
@ -362,11 +239,9 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("item.pattern.infinite.stored", "Stored patterns: %s") misc("item.pattern.infinite.stored", "Stored patterns: %s")
misc("item.pattern.line", "%s [%s%%]") misc("item.pattern.line", "%s [%s%%]")
misc("item.pattern.research", "Researched: %s%%") misc("item.pattern.research", "Researched: %s%%")
misc("item.pattern.research.item_count", "Items: %s / %s")
misc("item.pattern.research.advance", "Progress per item: %s%%")
misc("item.matter.storage", "Stored matter: %s / %s") misc("item.matter.infinite", "Stored matter: ∞ / ∞")
misc("item.matter.storage0", "Stored matter: %s") misc("item.matter.normal", "Stored matter: %s / %s")
misc("gui.matter_task.total", "Total: %s") misc("gui.matter_task.total", "Total: %s")
misc("gui.matter_task.required", "Left to be done: %s") misc("gui.matter_task.required", "Left to be done: %s")
@ -381,13 +256,9 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("pill.oblivion", "Items and Experience spent on research is fully refunded.") misc("pill.oblivion", "Items and Experience spent on research is fully refunded.")
misc("pill.message_oblivion", "All android features are removed and all research refunded.") misc("pill.message_oblivion", "All android features are removed and all research refunded.")
misc("pill.heal", "Provides 8 seconds of Regeneration III.") misc("pill.heal", "Instantly restores 4 hearts upon ingestion, provides 2 min Absorption V and 8 seconds Regeneration III.")
misc("pill.heal_android", "Does nothing to androids.") misc("pill.heal_android", "Does nothing to androids.")
misc("pill.not_normal", "Instantly kills fleshy creatures upon ingestion")
misc("pill.suspicious_food.desc", "On closer inspection, this food doesn't seem right...")
misc("pill.suspicious_food", "Suspicious %s")
misc("pill.message", "Nothing happened, but you feel... exhausted?.. Maybe get rest.") misc("pill.message", "Nothing happened, but you feel... exhausted?.. Maybe get rest.")
misc("pill.message_finish", "§kONE OF US ONE OF US ONE OF US") misc("pill.message_finish", "§kONE OF US ONE OF US ONE OF US")
@ -403,14 +274,9 @@ private fun misc(provider: MatteryLanguageProvider) {
gui("power.burn_time", "Burn time left: %s ticks") gui("power.burn_time", "Burn time left: %s ticks")
gui("progress_widget", "Progress: %s%%") gui("progress_widget", "Progress: %s%%")
gui("progress_widget_ticks", "Progress: %d / %d (%s%%)") gui("progress_widget_stuck", "The machine can not work, check configuration")
gui("fuel_widget", "Fuel: %s%%")
gui("fuel_widget_ticks", "Fuel: %d / %d (%s%%)")
gui("progress_stuck", "The machine can not work, check configuration")
gui("total_raw", "Total:") gui("total_raw", "Total:")
gui("total", "Total: %s")
gui("total_approx", "Total: ~%s")
gui("matter.percentage_level", "Matter level: %s%%") gui("matter.percentage_level", "Matter level: %s%%")
gui("matter.format", "Matter: %s") gui("matter.format", "Matter: %s")
@ -418,11 +284,6 @@ private fun misc(provider: MatteryLanguageProvider) {
gui("matter.format_and_complexity2", "%s (%s) / Complexity: %s (%s)") gui("matter.format_and_complexity2", "%s (%s) / Complexity: %s (%s)")
gui("matter.name", "MtU") gui("matter.name", "MtU")
gui("flywheel.top", "When used as flywheel core:")
gui("flywheel.storage", "* Storage: %s")
gui("flywheel.receive_efficiency", "* Wind up efficiency: %s")
gui("flywheel.momentum_loss_speed", "* Momentum loss speed factor: %s")
gui("filter.is_whitelist", "Is Whitelist") gui("filter.is_whitelist", "Is Whitelist")
gui("filter.match_nbt", "Match NBT") gui("filter.match_nbt", "Match NBT")
gui("filter.match_tag", "Match Tag") gui("filter.match_tag", "Match Tag")
@ -446,7 +307,6 @@ private fun misc(provider: MatteryLanguageProvider) {
misc("android_station.research.low_power", "Android Station is low on power! Can't research!") misc("android_station.research.low_power", "Android Station is low on power! Can't research!")
misc("android_station.research.researched", "Researched!") misc("android_station.research.researched", "Researched!")
misc("android_station.research.can_be_researched", "Ready to research!") misc("android_station.research.can_be_researched", "Ready to research!")
misc("android_station.research.can_not_afford", "Missing required items!")
misc("android_station.research.can_not_be_researched", "Can't research!") misc("android_station.research.can_not_be_researched", "Can't research!")
misc("android_station.research.xp_cost", "Experience cost: %s levels") misc("android_station.research.xp_cost", "Experience cost: %s levels")
misc("android_station.research.item", "Requires %s x%s") misc("android_station.research.item", "Requires %s x%s")
@ -481,9 +341,6 @@ private fun death(provider: MatteryLanguageProvider) {
death("otm_hawking_radiation", "%1\$s discovered Hawking radiation") death("otm_hawking_radiation", "%1\$s discovered Hawking radiation")
death("otm_emp", "%1\$s electronics' fried") death("otm_emp", "%1\$s electronics' fried")
death("otm_cosmic_rays", "%1\$s electronics' got scrambled by cosmic radiation") death("otm_cosmic_rays", "%1\$s electronics' got scrambled by cosmic radiation")
death("otm_android_discharge", "%1\$s ran out of power")
death("otm_not_normal_pill", "%1\$s took meds")
death("otm_not_normal_pill.item", "%1\$s took %2\$s")
death("otm_become_android.player", "%1\$s lost their humanity whilst %2\$s tried to reason with them") death("otm_become_android.player", "%1\$s lost their humanity whilst %2\$s tried to reason with them")
death("otm_become_humane.player", "%1\$s gained their humanity whilst %2\$s tried to reason with them") death("otm_become_humane.player", "%1\$s gained their humanity whilst %2\$s tried to reason with them")
@ -504,169 +361,62 @@ private fun death(provider: MatteryLanguageProvider) {
private fun blocks(provider: MatteryLanguageProvider) { private fun blocks(provider: MatteryLanguageProvider) {
with(provider.english) { with(provider.english) {
addBlock(MBlocks.ANDROID_STATION.values, "Android Station") add(MBlocks.ANDROID_STATION, "Android Station")
addBlock(MBlocks.ANDROID_STATION.values, "desc", "Grants access to android upgrades") add(MBlocks.BATTERY_BANK, "Battery Bank")
add(MBlocks.MATTER_DECOMPOSER, "Matter Decomposer")
addBlock(MBlocks.ANDROID_CHARGER.values, "Wireless Charger") add(MBlocks.MATTER_CAPACITOR_BANK, "Matter Capacitor Bank")
addBlock(MBlocks.ANDROID_CHARGER.values, "desc", "Charges nearby androids and exopacks")
addBlock(MBlocks.BATTERY_BANK.values, "Battery Bank")
addBlock(MBlocks.BATTERY_BANK.values, "desc", "Provides a way to use battery items as ordinary energy storage cell")
addBlock(MBlocks.MATTER_DECOMPOSER.values, "Matter Decomposer")
addBlock(MBlocks.MATTER_DECOMPOSER.values, "desc", "Breaks down items into pure matter")
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "Matter Capacitor Bank")
addBlock(MBlocks.MATTER_CAPACITOR_BANK.values, "desc", "Provides matter storage for system when matter capacitors are attached to it")
add(MBlocks.MATTER_CABLE, "Matter Network Cable") add(MBlocks.MATTER_CABLE, "Matter Network Cable")
add(MBlocks.PATTERN_STORAGE, "Pattern Storage") add(MBlocks.PATTERN_STORAGE, "Pattern Storage")
add(MBlocks.PATTERN_STORAGE, "desc", "Stores Patterns for system usage") add(MBlocks.MATTER_SCANNER, "Matter Scanner")
add(MBlocks.MATTER_PANEL, "Pattern Monitor")
addBlock(MBlocks.MATTER_SCANNER.values, "Matter Scanner") add(MBlocks.MATTER_REPLICATOR, "Matter Replicator")
addBlock(MBlocks.MATTER_SCANNER.values, "desc", "Scans items into Patterns for future replication") add(MBlocks.MATTER_BOTTLER, "Matter Bottler")
add(MBlocks.DRIVE_VIEWER, "Drive Viewer")
addBlock(MBlocks.MATTER_PANEL.values, "Pattern Monitor")
addBlock(MBlocks.MATTER_PANEL.values, "desc", "Allows to dispatch replication tasks")
addBlock(MBlocks.MATTER_REPLICATOR.values, "Matter Replicator")
addBlock(MBlocks.MATTER_REPLICATOR.values, "desc", "Executes replication tasks")
addBlock(MBlocks.MATTER_BOTTLER.values, "Matter Bottler")
addBlock(MBlocks.MATTER_BOTTLER.values, "desc", "Exchanges matter between matter holding items")
addBlock(MBlocks.ESSENCE_STORAGE.values, "Essence Storage")
addBlock(MBlocks.ESSENCE_STORAGE.values, "desc", "Allows to store and retrieve experience levels")
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "Matter Reconstructor")
addBlock(MBlocks.MATTER_RECONSTRUCTOR.values, "desc", "Repairs tools using matter")
addBlock(MBlocks.MATTER_RECYCLER.values, "Matter Recycler")
addBlock(MBlocks.MATTER_RECYCLER.values, "desc", "Refines matter dust back into pure matter")
add(MBlocks.MATTER_ENTANGLER, "Matter Entangler")
add(MBlocks.ENERGY_CABLES[CablesConfig.E.CRUDE]!!, "Crude Energy Cable")
add(MBlocks.ENERGY_CABLES[CablesConfig.E.REGULAR]!!, "Energy Cable")
add(MBlocks.ENERGY_CABLES[CablesConfig.E.ADVANCED]!!, "Advanced Energy Cable")
add(MBlocks.ENERGY_CABLES[CablesConfig.E.SUPERCONDUCTOR]!!, "Superconductive Energy Cable")
addBlock(MBlocks.DRIVE_VIEWER.values, "Drive Viewer")
add(MBlocks.BLACK_HOLE, "Local Anomalous Spacetime Dilation Singular Point") add(MBlocks.BLACK_HOLE, "Local Anomalous Spacetime Dilation Singular Point")
add(MBlocks.COBBLESTONE_GENERATOR, "Cobblestone Generator")
add(MBlocks.FLYWHEEL_SHAFT, "Flywheel Shaft") add(MBlocks.ESSENCE_STORAGE, "Essence Storage")
add(MBlocks.FLYWHEEL_SHAFT, "desc", "Placed between bearings, safe for decoration") add(MBlocks.ESSENCE_STORAGE, "desc", "Allows to store and retrieve experience levels")
add(MBlocks.MATTER_RECONSTRUCTOR, "Matter Reconstructor")
add(MBlocks.FLYWHEEL_BEARING, "Flywheel Bearing") add(MBlocks.MATTER_RECONSTRUCTOR, "desc", "Repairs tools using matter")
add(MBlocks.FLYWHEEL_BEARING, "desc", "Replaces top and bottom housing blocks in the center, safe for decoration")
add(MBlocks.FLYWHEEL_BATTERY, "Flywheel Controller")
add(MBlocks.FLYWHEEL_BATTERY, "desc", "Multiblock controller, requires housing, bearing, shaft, generator and core material of choice")
add(MBlocks.FLYWHEEL_BATTERY, "desc2", "Can have arbitrary height, with bottom limit of 4 blocks tall")
add(MBlocks.FLYWHEEL_BATTERY, "desc3", "Built as rectangular shape, with base surface of 5 by 5 blocks")
add(MBlocks.FLYWHEEL_BATTERY, "desc4", "Uses Energy *Interface*s as I/O ports, which must be put at same level as generator blocks inside structure,")
add(MBlocks.FLYWHEEL_BATTERY, "desc5", "replacing housing blocks")
add(MBlocks.FLYWHEEL_BATTERY, "desc6", "Important: must replace housing block in wall in middle at same level where flywheel material start,")
add(MBlocks.FLYWHEEL_BATTERY, "desc7", "in other words, controller is put one block above absolute bottom of structure")
add(MBlocks.FLYWHEEL_HOUSING, "Flywheel Housing")
add(MBlocks.FLYWHEEL_HOUSING, "desc", "5xNx5 multiblock casing, safe for decoration")
add(MBlocks.GENERATOR_BLOCK, "Generator Block")
add(MBlocks.GENERATOR_BLOCK, "desc", "Part of a multiblock, safe for decoration")
add(MBlocks.MODULAR_FRAME, "Modular Frame")
add(MBlocks.HEAVY_MODULAR_FRAME, "Heavy Modular Frame")
add(MBlocks.ENERGY_INPUT_INTERFACE, "Energy Input Interface")
add(MBlocks.ENERGY_OUTPUT_INTERFACE, "Energy Output Interface")
add(MBlocks.ENERGY_INPUT_HATCH, "Energy Input Hatch")
add(MBlocks.ITEM_INPUT_HATCH, "Item Input Hatch")
add(MBlocks.MATTER_INPUT_HATCH, "Matter Input Hatch")
add(MBlocks.ENERGY_OUTPUT_HATCH, "Energy Output Hatch")
add(MBlocks.ITEM_OUTPUT_HATCH, "Item Output Hatch")
add(MBlocks.MATTER_OUTPUT_HATCH, "Matter Output Hatch")
add(MBlocks.BLACK_HOLE_GENERATOR, "Matter Acceleration Power Generator")
add(MBlocks.TRITANIUM_HULL, "Tritanium Hull")
add(MBlocks.TRITANIUM_HULL, "desc", "A sturdy part of a multiblock, safe for decoration")
add(MBlocks.MATTER_INJECTOR, "Matter Injector")
add(MBlocks.ANTIMATTER_INJECTOR, "Antimatter Injector")
add(MBlocks.HIGH_ENERGY_PARTICLE_COLLECTOR, "High Energy Particle Collector")
addBlock(MBlocks.COBBLESTONE_GENERATOR.values, "Cobblestone Generator")
add(MBlocks.INFINITE_WATER_SOURCE, "Infinite Water Source")
add(MBlocks.INFINITE_WATER_SOURCE, "desc", "Pushes water into all neighbour blocks")
add(MBlocks.DEV_CHEST, "Dev Chest")
add(MBlocks.DEV_CHEST, "desc", "Contains all items present in game")
add(MBlocks.PAINTER, "Painting Table")
add(MBlocks.LIQUID_XP, "Liquid XP")
add(MItems.LIQUID_XP_BUCKET, "Liquid XP Bucket")
add(MBlocks.FLUID_TANK, "Fluid Tank") add(MBlocks.FLUID_TANK, "Fluid Tank")
add(MBlocks.FLUID_TANK, "named", "Fluid Tank (%s)") add(MBlocks.FLUID_TANK, "named", "Fluid Tank (%s)")
add(MBlocks.ENGINE, "Ship Engine") add(MBlocks.ENGINE, "Ship Engine")
add(MBlocks.ENGINE, "desc", "Unfortunately, it doesn't seem to be functional anymore.") add(MBlocks.ENGINE, "desc", "Unfortunately, it doesn't seem to be functional anymore.")
add(MBlocks.HOLO_SIGN, "Holo Sign") add(MBlocks.HOLO_SIGN, "Holo Sign")
add(MBlocks.HOLO_SIGN, "desc", "Multi-line, colored and glowing, text sign")
add(MBlocks.TRITANIUM_INGOT_BLOCK, "Tritanium Plating Block") add(MBlocks.TRITANIUM_INGOT_BLOCK, "Tritanium Plating Block")
add(MBlocks.WITHERED_STEEL_BLOCK, "Withered Steel Block")
add(MBlocks.ROFLITE_ALLOY_BLOCK, "Roflite Alloy Block")
addBlock(MBlocks.ENERGY_COUNTER.values, "Energy Counter") add(MBlocks.ENERGY_COUNTER, "Energy Counter")
addBlock(MBlocks.ENERGY_COUNTER.values, "desc", "Restricts energy flow direction;") add(MBlocks.ENERGY_COUNTER, "facing", "Input facing: %s")
addBlock(MBlocks.ENERGY_COUNTER.values, "desc2", "Allows to limit energy throughput;") add(MBlocks.ENERGY_COUNTER, "switch", "Switch input facing")
addBlock(MBlocks.ENERGY_COUNTER.values, "desc3", "Collects statistics of passed energy;") add(MBlocks.ENERGY_COUNTER, "limit", "I/O Limit. -1 means no limit")
addBlock(MBlocks.ENERGY_COUNTER.values, "desc4", "Displays flow activity on its monitor")
add(MBlocks.ENERGY_COUNTER[null]!!, "facing", "Input facing: %s")
add(MBlocks.ENERGY_COUNTER[null]!!, "switch", "Switch input facing")
add(MBlocks.ENERGY_COUNTER[null]!!, "limit", "I/O Limit. -1 means no limit")
add(MBlocks.ENERGY_COUNTER[null]!!, "display_this", "Display this information on block's screen")
add(MBlocks.ENERGY_COUNTER[null]!!, "do_pull", "Pull energy from input side and push to output")
add(MBlocks.ENERGY_COUNTER[null]!!, "dont_pull", "Don't pull energy")
addBlock(MBlocks.CHEMICAL_GENERATOR.values, "Chemical Generator")
addBlock(MBlocks.CHEMICAL_GENERATOR.values, "desc", "Generates power by burning solid fuels")
add(MBlocks.CHEMICAL_GENERATOR, "Chemical Generator")
add(MBlocks.DRIVE_RACK, "Condensation Drive Rack") add(MBlocks.DRIVE_RACK, "Condensation Drive Rack")
addBlock(MBlocks.ITEM_MONITOR.values, "Item Monitor") add(MBlocks.ITEM_MONITOR, "Item Monitor")
addBlock(MBlocks.PLATE_PRESS.values, "Plate Press") add(MBlocks.PLATE_PRESS, "Plate Press")
addBlock(MBlocks.TWIN_PLATE_PRESS.values, "Twin Plate Press")
addBlock(MBlocks.POWERED_FURNACE.values, "Electric Furnace") add(MBlocks.MATTER_RECYCLER, "Matter Recycler")
addBlock(MBlocks.POWERED_FURNACE.values, "desc", "Allows to smelt items using energy") add(MBlocks.ENERGY_SERVO, "Energy Servo")
addBlock(MBlocks.POWERED_SMOKER.values, "Microwave Oven") add(MBlocks.ENERGY_SERVO, "desc", "Charges, Discharges or Exchanges energy of items")
addBlock(MBlocks.POWERED_SMOKER.values, "desc", "Allows to process smoker recipes using energy")
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "Induction Furnace")
addBlock(MBlocks.POWERED_BLAST_FURNACE.values, "desc", "Allows to process blasting recipes using energy")
addBlock(MBlocks.ENERGY_SERVO.values, "Energy Servo")
addBlock(MBlocks.ENERGY_SERVO.values, "desc", "Charges, Discharges or Exchanges energy of items")
add(MBlocks.CARBON_FIBRE_BLOCK, "Carbon Fibre Block") add(MBlocks.CARBON_FIBRE_BLOCK, "Carbon Fibre Block")
add(MBlocks.METAL_JUNK, "Metal Junk Block") add(MBlocks.METAL_JUNK, "Metal Junk Block")
add(MBlocks.METAL_JUNK, "desc", "Useless junk, or is it?") add(MBlocks.METAL_JUNK, "desc", "Useless junk, or is it?")
add(MBlocks.METAL_MESH, "Metal Grate") add(MBlocks.METAL_MESH, "Metal Mesh")
add(MBlocks.TRITANIUM_STRIPED_BLOCK, "Tritanium Striped Block")
add(MBlocks.TRITANIUM_STRIPED_STAIRS, "Tritanium Striped Stairs")
add(MBlocks.TRITANIUM_STRIPED_SLAB, "Tritanium Striped Slab")
add(MBlocks.TRITANIUM_STRIPED_WALL, "Tritanium Striped Wall")
add(MBlocks.TRITANIUM_ORE, "Tritanium Ore") add(MBlocks.TRITANIUM_ORE, "Tritanium Ore")
add(MBlocks.DEEPSLATE_TRITANIUM_ORE, "Deepslate Tritanium Ore") add(MBlocks.DEEPSLATE_TRITANIUM_ORE, "Deepslate Tritanium Ore")
add(MBlocks.TRITANIUM_RAW_BLOCK, "Raw Tritanium Block") add(MBlocks.TRITANIUM_RAW_BLOCK, "Raw Tritanium Block")
add(MBlocks.DILITHIUM_ORE, "Dilithium Ore")
add(MBlocks.DEEPSLATE_DILITHIUM_ORE, "Deepslate Dilithium Ore")
add(MBlocks.DILITHIUM_CRYSTAL_BLOCK, "Dilithium Crystal Block")
add(MBlocks.STORAGE_CABLE, "Storage Cable") add(MBlocks.STORAGE_CABLE, "Storage Cable")
addBlock(MBlocks.STORAGE_POWER_SUPPLIER.values, "Storage Power Supplier") add(MBlocks.STORAGE_POWER_SUPPLIER, "Storage Power Supplier")
add(MBlocks.STORAGE_BUS, "Storage Bus") add(MBlocks.STORAGE_BUS, "Storage Bus")
add(MBlocks.STORAGE_IMPORTER, "Storage Importer") add(MBlocks.STORAGE_IMPORTER, "Storage Importer")
add(MBlocks.STORAGE_EXPORTER, "Storage Exporter") add(MBlocks.STORAGE_EXPORTER, "Storage Exporter")
@ -680,16 +430,11 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.PHANTOM_ATTRACTOR, "Phantom Attractor") add(MBlocks.PHANTOM_ATTRACTOR, "Phantom Attractor")
add(MBlocks.PHANTOM_ATTRACTOR, "desc", "Attracts Phantoms when it is night time") add(MBlocks.PHANTOM_ATTRACTOR, "desc", "Attracts Phantoms when it is night time")
add(MBlocks.REDSTONE_LAMP_INVERTED, "Redstone Lamp (Inverted signal)")
add(MBlocks.REINFORCED_REDSTONE_LAMP, "Reinforced Redstone Lamp")
add(MBlocks.REINFORCED_REDSTONE_LAMP_INVERTED, "Reinforced Redstone Lamp (Inverted signal)")
add(MBlocks.LABORATORY_LAMP, "Laboratory Lamp") add(MBlocks.LABORATORY_LAMP, "Laboratory Lamp")
add(MBlocks.LABORATORY_LAMP, "description", "Provides directional light with redstone switch") add(MBlocks.LABORATORY_LAMP, "description", "Provides directional light with redstone switch")
add(MBlocks.LABORATORY_LAMP_INVERTED, "Laboratory Lamp (Inverted signal)") add(MBlocks.LABORATORY_LAMP_INVERTED, "Laboratory Lamp (Inverted Signal)")
add(MBlocks.DANGER_STRIPE_BLOCK, "Danger Stripes") add(MBlocks.DANGER_STRIPE_BLOCK, "Danger Stripes")
add(MBlocks.METAL_BEAM, "Metal Beam") add(MBlocks.METAL_BEAM, "Metal Beam")
add(MBlocks.METAL_BEAM_CENTER, "Metal Beam (Center)")
add(MBlocks.TRITANIUM_DOOR[null]!!, "Tritanium Door") add(MBlocks.TRITANIUM_DOOR[null]!!, "Tritanium Door")
add(MBlocks.TRITANIUM_DOOR[null]!!, "description0", "High blast resistance door with redstone latch...") add(MBlocks.TRITANIUM_DOOR[null]!!, "description0", "High blast resistance door with redstone latch...")
@ -700,27 +445,14 @@ private fun blocks(provider: MatteryLanguageProvider) {
add(MBlocks.TRITANIUM_TRAPDOOR[null]!!, "description1", "...feeling safe now?") add(MBlocks.TRITANIUM_TRAPDOOR[null]!!, "description1", "...feeling safe now?")
add(MBlocks.TRITANIUM_BARS, "Tritanium Bars") add(MBlocks.TRITANIUM_BARS, "Tritanium Bars")
add(MBlocks.METAL_RAILING, "Metal Railing")
for ((color, blocks) in MBlocks.TRITANIUM_ANVIL.entries) { for (block in MBlocks.TRITANIUM_ANVIL)
if (color == null) {
for (block in blocks)
add(block, "Tritanium Anvil") add(block, "Tritanium Anvil")
} else {
for (block in blocks)
add(block, "${provider.englishColors.mapped[color]} Tritanium Anvil")
}
}
} }
} }
private fun items(provider: MatteryLanguageProvider) { private fun items(provider: MatteryLanguageProvider) {
with(provider.english) { with(provider.english) {
add(MItems.REDSTONE_INTERACTOR, "Redstone Key")
add(MItems.REDSTONE_INTERACTOR, "desc", "Allows to 'send' redstone signal out of any block")
add(MItems.REDSTONE_INTERACTOR, "desc1", "In other words, allows to temporarily activate redstone mechanisms, such as opening Iron Doors")
add(MItems.REDSTONE_INTERACTOR, "desc2", "Use while sneaking to set redstone timer")
add(MItems.PROCEDURAL_BATTERY, "Mythical Battery") add(MItems.PROCEDURAL_BATTERY, "Mythical Battery")
add(MItems.PROCEDURAL_BATTERY, "desc", "These batteries are found in dungeons with randomized stats") add(MItems.PROCEDURAL_BATTERY, "desc", "These batteries are found in dungeons with randomized stats")
@ -728,19 +460,17 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.EXPLOSIVE_HAMMER, "desc", "For those who feel bored") add(MItems.EXPLOSIVE_HAMMER, "desc", "For those who feel bored")
add(MItems.EXPLOSIVE_HAMMER, "primed", "Primed!") add(MItems.EXPLOSIVE_HAMMER, "primed", "Primed!")
add(MItems.EXPLOSIVE_HAMMER, "not_primed0", "Not primed") add(MItems.EXPLOSIVE_HAMMER, "not_primed0", "Not primed")
add(MItems.EXPLOSIVE_HAMMER, "not_primed1", "Prime with little of gunpowder and iron nugget payload in your inventory by holding RMB") add(MItems.EXPLOSIVE_HAMMER, "not_primed1", "Prime at crafting table with little of gunpowder and nugget payload")
add(MItems.EXOPACK_PROBE, "Exopack Probe") add(MItems.EXOPACK_PROBE, "Exopack Probe")
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE, "Creative Exopack Inventory Upgrade") add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE, "Creative Exopack Inventory Upgrade")
add(MItems.ExopackUpgrades.CRAFTING_UPGRADE, "Exopack Crafting Upgrade") add(MItems.ExopackUpgrades.CRAFTING_UPGRADE, "Exopack Crafting Upgrade")
add(MItems.ExopackUpgrades.SMELTING_UPGRADE, "Exopack Smelting Module")
add(MItems.ExopackUpgrades.ENDER_UPGRADE, "Exopack Ender Access Module")
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_WITHER, "Superdense Packing Upgrade") add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_WITHER, "Superdense Packing Upgrade")
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_WITHER, "description", "Utilizes similar principle that exhibit Nether Stars") add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_WITHER, "description", "Utilizes similar principle that exhibit Nether Stars")
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON, "Ender Link Pocket Dimension Upgrade") add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON, "Ender Link Pocket Dimension Upgrade")
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON, "description", "Allows to store items in portable pocket dimension. Also grants access to Ender Chest contents.") add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON, "description", "Allows to store items in portable pocket dimension")
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL, "Indescribable Exopack Inventory Upgrade") add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL, "Indescribable Exopack Inventory Upgrade")
add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL, "description", "They normally generate in dungeons with appropriate NBT tag attached") add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL, "description", "They normally generate in dungeons with appropriate NBT tag attached")
@ -748,11 +478,10 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ESSENCE_CAPSULE, "Essence Capsule") add(MItems.ESSENCE_CAPSULE, "Essence Capsule")
add(MItems.ESSENCE_DRIVE, "Essence Memory Holotape") add(MItems.ESSENCE_DRIVE, "Essence Memory Holotape")
add(MItems.ESSENCE_SERVO, "Essence Servo") add(MItems.ESSENCE_SERVO, "Essence Servo")
add(MItems.ESSENCE_SERVO, "desc", "Allows to absorb nearby experience orbs directly into essence storage") add(MItems.ESSENCE_SERVO, "desc", "Allows to 'pump' essence involving fleshy humanoids")
add(MItems.ESSENCE_SERVO, "desc2", "Can be used as a tool to pump essence manually") add(MItems.ESSENCE_SERVO, "desc2", "Can be used standalone, or as tool inside Essence Servo")
add(MItems.NUTRIENT_PASTE, "Nutrient Paste") add(MItems.NUTRIENT_PASTE, "Nutrient Paste")
add(MItems.IMPERFECT_BREAD, "Imperfect Bread")
add(MItems.FLUID_CAPSULE, "Fluid Capsule") add(MItems.FLUID_CAPSULE, "Fluid Capsule")
add(MItems.FLUID_CAPSULE, "named", "Fluid Capsule (%s)") add(MItems.FLUID_CAPSULE, "named", "Fluid Capsule (%s)")
@ -784,8 +513,6 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.TRITANIUM_SHEARS, "Tritanium Shears") add(MItems.TRITANIUM_SHEARS, "Tritanium Shears")
add(MItems.TRITANIUM_SHIELD, "Tritanium Shield") add(MItems.TRITANIUM_SHIELD, "Tritanium Shield")
add(MItems.WITHERED_STEEL_SWORD, "Withered Steel Sword")
add(MItems.TRITANIUM_HELMET, "Tritanium Helmet") add(MItems.TRITANIUM_HELMET, "Tritanium Helmet")
add(MItems.TRITANIUM_CHESTPLATE, "Tritanium Chestplate") add(MItems.TRITANIUM_CHESTPLATE, "Tritanium Chestplate")
add(MItems.TRITANIUM_PANTS, "Tritanium Leggings") add(MItems.TRITANIUM_PANTS, "Tritanium Leggings")
@ -798,19 +525,11 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.TRITANIUM_DUST, "Tritanium Dust") add(MItems.TRITANIUM_DUST, "Tritanium Dust")
add(MItems.TRITANIUM_INGOT, "Tritanium Ingot") add(MItems.TRITANIUM_INGOT, "Tritanium Ingot")
add(MItems.DILITHIUM_CRYSTAL, "Dilithium Crystal")
add(MItems.WITHERED_STEEL, "Withered Steel Ingot")
add(MItems.ROFLITE_ALLOY_INGOT, "Roflite Alloy Ingot")
add(MItems.TRITANIUM_NUGGET, "Tritanium Nugget") add(MItems.TRITANIUM_NUGGET, "Tritanium Nugget")
add(MItems.MATTER_IO_PORT, "Matter IO Port") add(MItems.MATTER_IO_PORT, "Matter IO Port")
add(MItems.MATTER_TRANSFORM_MATRIX, "Matter Transformation Matrix") add(MItems.MATTER_TRANSFORM_MATRIX, "Matter Transformation Matrix")
add(MItems.ANTIMATTER_TRANSFORM_MATRIX, "Antimatter Transformation Matrix")
add(MItems.ANTIMATTER_TRANSFORM_MATRIX, "desc", "Can be found in The End cities")
add(MItems.ENERGY_BUS, "Energy Bus") add(MItems.ENERGY_BUS, "Energy Bus")
add(MItems.ELECTRIC_PARTS, "Electric Parts") add(MItems.ELECTRIC_PARTS, "Electric Parts")
add(MItems.ELECTRIC_PARTS, "desc", "Capacitors, resistors, diodes, jumpers...")
add(MItems.MECHANICAL_PARTS, "Mechanical Parts")
add(MItems.MECHANICAL_PARTS, "desc", "Bearings, gears, fittings, axial shafts...")
add(MItems.MACHINE_FRAME, "Machine Frame") add(MItems.MACHINE_FRAME, "Machine Frame")
add(MItems.TRITANIUM_PLATE, "Tritanium Plate") add(MItems.TRITANIUM_PLATE, "Tritanium Plate")
add(MItems.IRON_PLATE, "Iron Plate") add(MItems.IRON_PLATE, "Iron Plate")
@ -824,17 +543,12 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ADVANCED_CONTROL_CIRCUIT, "Advanced Control Circuit") add(MItems.ADVANCED_CONTROL_CIRCUIT, "Advanced Control Circuit")
add(MItems.QUANTUM_TRANSCEIVER, "Quantum Transceiver") add(MItems.QUANTUM_TRANSCEIVER, "Quantum Transceiver")
add(MItems.ELECTROMAGNET, "Electromagnet") add(MItems.ELECTROMAGNET, "Electromagnet")
add(MItems.ELECTROMOTOR, "Electromotor")
add(MItems.MIRROR_COMPOUND, "Mirror Compound") add(MItems.MIRROR_COMPOUND, "Mirror Compound")
add(MItems.MIRROR, "Mirror") add(MItems.MIRROR, "Mirror")
add(MItems.MIRROR, "desc", "I can clearly see my own reflection in this mirror") add(MItems.MIRROR, "description", "I can clearly see my own reflection in this mirror")
add(MItems.REINFORCED_TRITANIUM_PLATE, "Reinforced Tritanium Plate") add(MItems.REINFORCED_TRITANIUM_PLATE, "Reinforced Tritanium Plate")
add(MItems.REINFORCED_TRITANIUM_PLATE, "desc", "An armor plate, reinforced to withstand great kinetic forces") add(MItems.REINFORCED_TRITANIUM_PLATE, "description", "An armor plate, reinforced to withstand great kinetic forces")
add(MItems.REINFORCED_IRON_PLATE, "Reinforced Iron Plate")
add(MItems.REINFORCED_IRON_PLATE, "desc", "A sturdier and more durable Iron Plate")
add(MItems.ARMOR_ASSEMBLY, "Armor assembly")
add(MItems.CARBON_MESH, "Carbon Mesh") add(MItems.CARBON_MESH, "Carbon Mesh")
add(MItems.DISPLAY_SCREEN, "Display Screen")
add(MItems.GRAVITATIONAL_DISRUPTOR, "Spacetime Equalizer") add(MItems.GRAVITATIONAL_DISRUPTOR, "Spacetime Equalizer")
@ -854,7 +568,6 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.PILL_HUMANE, "Humane Pill") add(MItems.PILL_HUMANE, "Humane Pill")
add(MItems.PILL_OBLIVION, "Android Factory Reset Pill") add(MItems.PILL_OBLIVION, "Android Factory Reset Pill")
add(MItems.PILL_HEAL, "Medical Pill") add(MItems.PILL_HEAL, "Medical Pill")
add(MItems.PILL_NOT_NORMAL, "Not/Normal Pill")
add(MItems.MATTER_CAPACITOR_PARTS, "Matter Capacitor Parts") add(MItems.MATTER_CAPACITOR_PARTS, "Matter Capacitor Parts")
add(MItems.MATTER_CAPACITOR_BASIC, "Basic Matter Capacitor") add(MItems.MATTER_CAPACITOR_BASIC, "Basic Matter Capacitor")
@ -868,85 +581,19 @@ private fun items(provider: MatteryLanguageProvider) {
add(MItems.ENERGY_SWORD, "desc3", "Always strikes surrounding enemies with full damage if empowered") add(MItems.ENERGY_SWORD, "desc3", "Always strikes surrounding enemies with full damage if empowered")
add(MItems.ENERGY_SWORD, "desc4", "Does not benefit from Sweeping Edge enchantment") add(MItems.ENERGY_SWORD, "desc4", "Does not benefit from Sweeping Edge enchantment")
add(MItems.FALLING_SUN, "◄ Falling Sun ►")
add(MItems.FALLING_SUN, "desc", "Prototype weapon, needs power to operate")
add(MItems.FALLING_SUN, "desc2", "Deals extra damage to androids when empowered")
add(MItems.FALLING_SUN, "desc3", "Always strikes surrounding enemies with full damage if empowered")
add(MItems.FALLING_SUN, "desc4", "Does not benefit from Sweeping Edge enchantment")
add(MItems.PORTABLE_CONDENSATION_DRIVE, "Portable Condensation Drive") add(MItems.PORTABLE_CONDENSATION_DRIVE, "Portable Condensation Drive")
add(MItems.PORTABLE_DENSE_CONDENSATION_DRIVE, "Portable Dense Condensation Drive") add(MItems.PORTABLE_DENSE_CONDENSATION_DRIVE, "Portable Dense Condensation Drive")
add(MItems.PLASMA_RIFLE, "Plasma Repeater")
add(MItems.TRITANIUM_ORE_CLUMP, "Raw Tritanium") add(MItems.TRITANIUM_ORE_CLUMP, "Raw Tritanium")
add(MItems.PATTERN_DRIVE_NORMAL, "Pattern Drive") add(MItems.PATTERN_DRIVE_NORMAL, "Pattern Drive")
add(MItems.PATTERN_DRIVE_DOUBLE, "Double-Level Pattern Drive")
add(MItems.PATTERN_DRIVE_TRIPLE, "Triple-Level Pattern Drive")
add(MItems.PATTERN_DRIVE_QUAD, "Quad-Level Pattern Drive")
add(MItems.PATTERN_DRIVE_CREATIVE, "Creative Pattern Drive") add(MItems.PATTERN_DRIVE_CREATIVE, "Creative Pattern Drive")
add(MItems.GOLD_DISK, "Gold Disk")
add(MItems.GOLD_DISK, "single_item", "Gold Disk (%s)")
add(MItems.PATTERN_DRIVE_CREATIVE2, "Omni-Present Pattern Drive") add(MItems.PATTERN_DRIVE_CREATIVE2, "Omni-Present Pattern Drive")
add(MItems.PATTERN_DRIVE_CREATIVE2, "description1", "Creative-only item") add(MItems.PATTERN_DRIVE_CREATIVE2, "description1", "Creative-only item")
add(MItems.PATTERN_DRIVE_CREATIVE2, "description2", "Holds pattern for every item that have matter value") add(MItems.PATTERN_DRIVE_CREATIVE2, "description2", "Holds pattern for every item that have matter value")
add(MItems.ZPM_BATTERY, "Zero Point Module") add(MItems.ZPM_BATTERY, "Zero Point Module")
add(MItems.ZPM_BATTERY, "description", "Can be found in hands of those who travel between dimensions, if they ever reached different reality of origin of these constructs...") add(MItems.ZPM_BATTERY, "description", "Can be found in hands of those who travel between dimensions, if they ever reached different reality of origin of these constructs...")
add(MItems.MachineUpgrades.Basic.BLANK, "Basic Upgrade Template")
add(MItems.MachineUpgrades.Basic.SPEED, "Basic Speed Upgrade")
add(MItems.MachineUpgrades.Basic.ENERGY_CONSUMPTION, "Basic Energy Consumption Upgrade")
add(MItems.MachineUpgrades.Basic.FAILSAFE, "Basic Failsafe Upgrade")
add(MItems.MachineUpgrades.Basic.ENERGY_STORAGE, "Basic Energy Storage Upgrade")
add(MItems.MachineUpgrades.Basic.MATTER_STORAGE, "Basic Matter Storage Upgrade")
add(MItems.MachineUpgrades.Basic.PROCESSING_ITEMS, "Basic Item Processing Upgrade")
add(MItems.MachineUpgrades.Normal.BLANK, "Upgrade Template")
add(MItems.MachineUpgrades.Normal.SPEED, "Speed Upgrade")
add(MItems.MachineUpgrades.Normal.ENERGY_CONSUMPTION, "Energy Consumption Upgrade")
add(MItems.MachineUpgrades.Normal.FAILSAFE, "Failsafe Upgrade")
add(MItems.MachineUpgrades.Normal.ENERGY_STORAGE, "Energy Storage Upgrade")
add(MItems.MachineUpgrades.Normal.MATTER_STORAGE, "Matter Storage Upgrade")
add(MItems.MachineUpgrades.Normal.PROCESSING_ITEMS, "Item Processing Upgrade")
add(MItems.MachineUpgrades.Advanced.BLANK, "Advanced Upgrade Template")
add(MItems.MachineUpgrades.Advanced.SPEED, "Advanced Speed Upgrade")
add(MItems.MachineUpgrades.Advanced.ENERGY_CONSUMPTION, "Advanced Energy Consumption Upgrade")
add(MItems.MachineUpgrades.Advanced.FAILSAFE, "Advanced Failsafe Upgrade")
add(MItems.MachineUpgrades.Advanced.ENERGY_STORAGE, "Advanced Energy Storage Upgrade")
add(MItems.MachineUpgrades.Advanced.MATTER_STORAGE, "Advanced Matter Storage Upgrade")
add(MItems.MachineUpgrades.Advanced.PROCESSING_ITEMS, "Advanced Item Processing Upgrade")
add(MItems.MachineUpgrades.Creative.SPEED, "Creative Speed Upgrade")
add(MItems.MachineUpgrades.Creative.ENERGY_CONSUMPTION, "Creative Energy Consumption Upgrade")
add(MItems.MachineUpgrades.Creative.ENERGY_STORAGE, "Creative Energy Storage Upgrade")
add(MItems.MachineUpgrades.Creative.ENERGY_STORAGE_FLAT, "Creative Energy Storage Upgrade (Flat)")
add(MItems.MachineUpgrades.Creative.ENERGY_STORAGE_FLAT_SMALL, "Creative Energy Storage Upgrade (Flat Small)")
add(MItems.MachineUpgrades.Creative.MATTER_STORAGE, "Creative Matter Storage Upgrade")
add(MItems.MachineUpgrades.Creative.MATTER_STORAGE_FLAT, "Creative Matter Storage Upgrade (Flat)")
add(MItems.MachineUpgrades.Creative.MATTER_STORAGE_FLAT_SMALL, "Creative Matter Storage Upgrade (Flat Small)")
add(MItems.MachineUpgrades.Creative.ENERGY_THROUGHPUT, "Creative Energy Throughput Upgrade")
add(MItems.MachineUpgrades.Creative.ENERGY_THROUGHPUT_FLAT, "Creative Energy Throughput Upgrade (Flat)")
add(MItems.MachineUpgrades.Creative.ENERGY_THROUGHPUT_FLAT_SMALL, "Creative Energy Throughput Upgrade (Flat Small)")
add(MItems.MachineUpgrades.Creative.FAILSAFE, "Creative Failsafe Upgrade")
add(MItems.MachineUpgrades.Creative.FAILURE, "Creative Failure Upgrade")
add(MItems.MachineUpgrades.Creative.PROCESSING_ITEMS, "Creative Item Processing Upgrade")
add(MItems.CHEST_UPGRADER, "Crate-r")
add(MItems.CHEST_UPGRADER, "desc", "Replaces placed chests and barrels with cargo crates while keeping storage contents")
add(MItems.CHEST_UPGRADER, "desc2", "Hold desired crates in the opposite hand")
add(MItems.CONFIGURATOR, "Configurator")
add(MItems.CONFIGURATOR, "desc", "Copies configuration from one block to another")
add(MItems.CONFIGURATOR, "desc2", "Sneak-use on block to copy, use to paste")
add(MItems.CONFIGURATOR, "desc3", "Use on air while sneaking to clear saved configuration")
add(MItems.CONFIGURATOR, "desc_saved", "Saved configuration for: %s")
add(MItems.BREAD_MONSTER_SPAWN_EGG, "Bread Monster Spawn Egg")
add(MEntityTypes.BREAD_MONSTER, "Bread Monster")
add(MItems.LOADER_SPAWN_EGG, "Loader Spawn Egg")
add(MEntityTypes.LOADER, "Loader")
} }
} }
@ -980,8 +627,8 @@ private fun androidFeatures(provider: MatteryLanguageProvider) {
add(AndroidFeatures.NIGHT_VISION, "Night Vision") add(AndroidFeatures.NIGHT_VISION, "Night Vision")
add(AndroidFeatures.NANOBOTS_ARMOR, "Nanobots Armor") add(AndroidFeatures.NANOBOTS_ARMOR, "Nanobots Armor")
add(AndroidFeatures.ITEM_MAGNET, "Item Magnet") add(AndroidFeatures.ITEM_MAGNET, "Item Magnet")
add(AndroidFeatures.SWIM_BOOSTERS, "Swim Boosters")
add(AndroidFeatures.STEP_ASSIST, "Step Assist") add(AndroidFeatures.STEP_ASSIST, "Step Assist")
add(AndroidFeatures.PHANTOM_ATTRACTOR, "Phantom Attractor")
add(AndroidFeatures.JUMP_BOOST, "Jump Boost") add(AndroidFeatures.JUMP_BOOST, "Jump Boost")
add(AndroidFeatures.ENDER_TELEPORTER, "Ender Teleporter") add(AndroidFeatures.ENDER_TELEPORTER, "Ender Teleporter")
} }
@ -989,101 +636,8 @@ private fun androidFeatures(provider: MatteryLanguageProvider) {
private fun gui(provider: MatteryLanguageProvider) { private fun gui(provider: MatteryLanguageProvider) {
with(provider.english) { with(provider.english) {
gui("quickmove_from.restock", "Restock from storage")
gui("quickmove_from.restock_with_move", "Quickstack from storage")
gui("quickmove_from.move", "Take all")
gui("quickmove_to.restock", "Restock to storage")
gui("quickmove_to.restock_with_move", "Quickstack to storage")
gui("quickmove_to.move", "Deposit all")
gui("quickmove.exchange", "Smart exchange with storage")
gui("quickmove.exchange.desc", "Filtered slots get restocked, everything else gets quickstacked from Exopack")
gui("quickmove_hint", "Right click to show all variants")
gui("exopack.accept_wireless_charge", "Accept wireless charging")
gui("exopack.dont_accept_wireless_charge", "Do not accept wireless charging")
gui("charge_androids", "Charge Androids")
gui("dont_charge_androids", "Do not charge Androids")
gui("charge_exopacks", "Charge Exopacks")
gui("dont_charge_exopacks", "Do not charge Exopacks")
gui("multiblock.formed", "Multiblock is formed: %s")
gui("flywheel.current_loss_t", "Current energy loss per tick:")
gui("flywheel.current_loss_s", "Current energy loss per second:")
gui("flywheel.core_material", "Core material:")
gui("flywheel.core_material_count", "(Core block count: %s)")
gui("flow_direction_set", "Flow direction set to %s")
gui("tick_timer_set", "Timer set to %s ticks")
gui("config_copied", "Copied configuration for %s")
gui("config_pasted", "Applied saved configuration")
gui("config_cleared", "Configuration cleared")
gui("config_missing", "No configuration to apply")
gui("black_hole_generator.help0", "Generates energy using angular momentum of Singularities")
gui("black_hole_generator.help1", "The stronger gravity Singularity has, the more power is generated!")
gui("black_hole_generator.help2", "Using Spacetime Normalizers will reduce gravitation strength of Singularity, which will reduce power output.")
gui("black_hole_generator.help3", "This machine is the only 'safe' way of disposing Singularities, by draining them dry by continuously injecting antimatter until Singularity lose all its mass")
gui("black_hole_generator.injection_rate.mode", "Injection rate")
gui("black_hole_generator.injection_rate.desc", "Amount of MtU injected each tick, from either injectors (or both)")
gui("black_hole_generator.target_mass.mode", "Target mass")
gui("black_hole_generator.sustain.mode", "Sustain")
gui("black_hole_generator.sustain.desc", "Keep Singularity's mass at target level, injecting matter or antimatter when necessary")
gui("black_hole_generator.matter_only.mode", "Inject matter only")
gui("black_hole_generator.matter_only.desc", "Only inject matter into singularity. Way less power generated, but mass of Singularity will increase over time, as well as power output")
gui("black_hole_generator.antimatter_only.mode", "Inject antimatter only")
gui("black_hole_generator.antimatter_only.desc", "Only inject antimatter into singularity. Way more power generated, but mass of Singularity will decrease over time, as well as power output")
gui("draw_multiblock_guide", "Draw building guide")
gui("ago", "%s ago")
gui("time.short.5s", "5s")
gui("time.short.15s", "15s")
gui("time.short.1m", "1m")
gui("time.short.10m", "10m")
gui("time.short.1h", "1h")
gui("time.short.6h", "6h")
gui("time.short.24h", "24h")
gui("part_of_multiblock", "Part of multiblock structure, useless on its own")
gui("quicksearch", "Quick search...") gui("quicksearch", "Quick search...")
gui("painter.is_bulk", "Bulk painting")
gui("painter.is_bulk.desc", "Input slot will be automatically refilled from your inventory")
gui("painter.is_bulk.desc2", "Quick moving result will paint as many items as possible from your inventory")
gui("energy_required", "Energy required: %s")
gui("insert_priority", "Insert priority")
gui("extract_priority", "Extract priority")
gui("increase", "Increase")
gui("decrease", "Decrease")
gui("color_picker", "Color Picker")
gui("color.short.red", "R")
gui("color.short.green", "G")
gui("color.short.blue", "B")
gui("color.short.hue", "H")
gui("color.short.saturation", "S")
gui("color.short.value", "V")
gui("color.full.red", "Red")
gui("color.full.green", "Green")
gui("color.full.blue", "Blue")
gui("color.full.hue", "Hue")
gui("color.full.saturation", "Saturation")
gui("color.full.value", "Value")
gui("item_monitor.refill_source.desc", "Controls from where to take items for slot auto refill") gui("item_monitor.refill_source.desc", "Controls from where to take items for slot auto refill")
gui("item_monitor.refill_source.system", "System only. Crafting grid will be auto refilled only from storage system. This is the behavior you see in AE2 and Refined Storage") gui("item_monitor.refill_source.system", "System only. Crafting grid will be auto refilled only from storage system. This is the behavior you see in AE2 and Refined Storage")
gui("item_monitor.refill_source.inventory", "Inventory only. Crafting grid will be auto refilled only from player's inventory") gui("item_monitor.refill_source.inventory", "Inventory only. Crafting grid will be auto refilled only from player's inventory")
@ -1103,12 +657,9 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("stored_amount", "Exact amount stored: %s") gui("stored_amount", "Exact amount stored: %s")
gui("sides.item_config", "Item") gui("sides.item_config", "Item Configuration")
gui("sides.energy_config", "Energy") gui("sides.energy_config", "Energy Configuration")
gui("sides.fluid_config", "Fluid") gui("sides.fluid_config", "Fluid Configuration")
gui("sides.pull_help", "Hold Shift to cycle pull mode")
gui("sides.push_help", "Hold Ctrl to cycle push mode")
gui("sides.top", "Top") gui("sides.top", "Top")
gui("sides.bottom", "Bottom") gui("sides.bottom", "Bottom")
@ -1126,41 +677,11 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("side_mode.pull", "Pull") gui("side_mode.pull", "Pull")
gui("side_mode.push", "Push") gui("side_mode.push", "Push")
gui("upgrades", "Upgrades")
gui("upgrades.current", "Active upgrades:")
gui("upgrade.speed", "Operating speed: %s%%")
gui("upgrade.speed_limit", "Operating speed: %s%% (limit)")
gui("upgrade.processing_items", "Items processed per cycle: +%s")
gui("upgrade.energy_storage_flat", "Energy capacity: +%s")
gui("upgrade.matter_storage_flat", "Matter capacity: +%s")
gui("upgrade.energy_storage", "Energy capacity: +%s%%")
gui("upgrade.matter_storage", "Matter capacity: +%s%%")
gui("upgrade.energy_consumed", "Energy consumption: %s%%")
gui("upgrade.energy_consumed_limit", "Energy consumption: %s%% (limit)")
gui("upgrade.energy_throughput_flat", "Energy throughput: +%s")
gui("upgrade.energy_throughput", "Energy throughput: +%s%%")
gui("upgrade.failsafe", "Failure chance: %s%%")
gui("upgrade_type.list", "Upgrade classification:")
gui("upgrade_type.allowed", "Allowed upgrades:")
gui("upgrade_type.allowed_none", "No possible upgrades at the moment.")
gui("upgrade_type.speed", "Speed")
gui("upgrade_type.processing", "Processing")
gui("upgrade_type.matter_storage", "Matter Storage")
gui("upgrade_type.energy_storage", "Energy Storage")
gui("upgrade_type.energy_consumption", "Energy Consumption")
gui("upgrade_type.energy_throughput", "Energy Throughput")
gui("upgrade_type.failsafe", "Failsafe")
gui("balance_inputs", "Balance input slots")
gui("sorting.sort_now", "Sort")
gui("sorting.sort_settings", "Right click to show settings")
gui("sorting.default", "Default sorting") gui("sorting.default", "Default sorting")
gui("sorting.name", "Sort by name") gui("sorting.name", "Sort by name")
gui("sorting.id", "Sort by ID") gui("sorting.id", "Sort by ID")
gui("sorting.modid", "Sort by Namespace (mod) ID") gui("sorting.modid", "Sort by Namespace (mod) ID")
gui("sorting.count", "Sort by quantity") gui("sorting.count", "Sort by amount")
gui("sorting.ascending", "Ascending") gui("sorting.ascending", "Ascending")
gui("sorting.descending", "Descending") gui("sorting.descending", "Descending")
gui("sorting.matter_value", "Matter value") gui("sorting.matter_value", "Matter value")
@ -1175,10 +696,6 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("matter_panel.label", "Replication request") gui("matter_panel.label", "Replication request")
gui("matter_panel.task", "Ongoing replication task") gui("matter_panel.task", "Ongoing replication task")
gui("matter_panel.task_line", "%s: %s | %s / %s") gui("matter_panel.task_line", "%s: %s | %s / %s")
gui("matter_panel.is_providing_tasks", "Tasks are dispatched to replicators")
gui("matter_panel.not_providing_tasks", "Tasks are NOT dispatched to replicators")
gui("matter_panel.cancel_all", "Cancel all tasks")
gui("matter_panel.cancel_all.desc", "Do you really want to cancel all replication tasks?")
gui("matter_panel.tasks", "Tasks") gui("matter_panel.tasks", "Tasks")
gui("matter_panel.patterns", "Patterns") gui("matter_panel.patterns", "Patterns")
@ -1190,9 +707,7 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("matter_panel.complexity", "Total complexity: %s") gui("matter_panel.complexity", "Total complexity: %s")
gui("experience", "%s experience points") gui("experience", "%s experience points")
gui("experience_with_limit", "%s / %s experience points")
gui("experience_levels", "%s experience levels") gui("experience_levels", "%s experience levels")
gui("experience_levels_with_limit", "%s / %s experience levels")
gui("experience.store", "Store %s experience levels") gui("experience.store", "Store %s experience levels")
gui("experience.store_all", "Store all experience levels") gui("experience.store_all", "Store all experience levels")
@ -1201,42 +716,11 @@ private fun gui(provider: MatteryLanguageProvider) {
gui("experience.set_exact", "Set your experience level to %s") gui("experience.set_exact", "Set your experience level to %s")
gui("essence_capsule", "(Almost) Everything you ever knew is within") gui("essence_capsule", "(Almost) Everything you ever knew is within")
gui("essence_capsule2", "This item can be recycled at Essence Storage") gui("essence_capsule2", "This item can be recycled at Essence Servo")
gui("essence_capsule3", "Use to break free most of stored knowledge")
gui("essence_capsule.digital", "Use to scan memories stored within")
gui("slot_filter.filtered", "This slot is filtered for automation") gui("slot_filter.filtered", "This slot is filtered for automation")
gui("slot_filter.forbidden", "This slot is forbidden for automation mechanisms") gui("slot_filter.forbidden", "This slot is forbidden for automation mechanisms")
gui("slot_filter.hint", "To remove slot filter press Ctrl + LMB") gui("slot_filter.hint", "To remove slot filter press Ctrl + LMB")
gui("tooltip.enum.active", "> %s")
gui("debug.tags.help", "Hold Shift to display tags")
gui("debug.tags.item.title", "Item tags:")
gui("debug.tags.block.title", "Block tags:")
gui("debug.tags.tag.entry", " - %s")
}
}
private fun jade(provider: MatteryLanguageProvider) {
with(provider.english) {
jadeloc("matter_storage", "Matter Storage")
jadeloc("mattery_energy", "Energy Storage")
jadeloc("mattery_worker", "Machine Job Progress")
jadeloc("matter_bottler", "Matter Bottler Mode")
jadeloc("matter_reconstructor", "Matter Reconstructor Progress")
jade("mode", "Mode: %s")
jade("matter_bottler.mode.fill", "Filling")
jade("matter_bottler.mode.drain", "Emptying")
}
}
private fun maps(provider: MatteryLanguageProvider) {
with(provider.english) {
map("laboratory", "Laboratory Map")
map("wreckage", "Wreckage Map")
} }
} }
@ -1254,10 +738,6 @@ fun AddEnglishLanguage(provider: MatteryLanguageProvider) {
research(provider) research(provider)
gui(provider) gui(provider)
jade(provider)
maps(provider)
with(provider.english) { with(provider.english) {
add("itemGroup.otm", "Overdrive That Matters") add("itemGroup.otm", "Overdrive That Matters")
add("itemGroup.otm_decorative", "Overdrive That Matters Decorative") add("itemGroup.otm_decorative", "Overdrive That Matters Decorative")

View File

@ -1,5 +1,6 @@
package ru.dbotthepony.mc.otm.datagen.lang package ru.dbotthepony.mc.otm.datagen.lang
import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableMap import com.google.common.collect.ImmutableMap
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
import net.minecraft.data.DataGenerator import net.minecraft.data.DataGenerator
@ -12,13 +13,14 @@ import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.enchantment.Enchantment
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.neoforged.neoforge.common.data.LanguageProvider import net.minecraftforge.common.data.LanguageProvider
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.player.android.AndroidFeatureType import ru.dbotthepony.mc.otm.android.AndroidFeatureType
import ru.dbotthepony.mc.otm.player.android.AndroidResearchType import ru.dbotthepony.mc.otm.android.AndroidResearch
import ru.dbotthepony.mc.otm.util.TranslatableComponent import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
private fun researchString(key: AndroidResearchType): String { private fun researchString(key: AndroidResearchType): String {
@ -78,13 +80,11 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
fun add(key: String, value: String) = slave.add(key, value) fun add(key: String, value: String) = slave.add(key, value)
fun add(key: Block, value: String) = slave.add(key, value) fun add(key: Block, value: String) = slave.add(key, value)
fun addBlock(key: Collection<Block>, value: String) = key.forEach { add(it, value) }
fun add(key: Block, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value) fun add(key: Block, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value)
fun addBlock(key: Collection<Block>, suffix: String, value: String) = key.forEach { add(it, suffix, value) }
fun add(key: Item, value: String) = slave.add(key, value) fun add(key: Item, value: String) = slave.add(key, value)
fun addItem(key: Collection<Item>, value: String) = key.forEach { add(it, value) }
fun add(key: Item, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value) fun add(key: Item, suffix: String, value: String) = slave.add("${key.descriptionId}.${suffix}", value)
fun add(key: ItemStack, value: String) = slave.add(key, value) fun add(key: ItemStack, value: String) = slave.add(key, value)
fun add(key: Enchantment, value: String) = slave.add(key, value)
fun add(key: MobEffect, value: String) = slave.add(key, value) fun add(key: MobEffect, value: String) = slave.add(key, value)
fun add(key: EntityType<*>, value: String) = slave.add(key, value) fun add(key: EntityType<*>, value: String) = slave.add(key, value)
@ -104,11 +104,6 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
fun sound(key: String, value: String) = slave.add("otm.sound.$key", value) fun sound(key: String, value: String) = slave.add("otm.sound.$key", value)
fun sound(key: SoundEvent, value: String) = slave.add("otm.sound.${key.location.path}", value) fun sound(key: SoundEvent, value: String) = slave.add("otm.sound.${key.location.path}", value)
fun jade(key: String, value: String) = slave.add("otm.jade.$key", value)
fun jadeloc(key: String, value: String) = slave.add("config.jade.plugin_${DataGen.MOD_ID}.$key", value)
fun map(key: String, value: String) = slave.add("filled_map.otm_$key", value)
inner class Prepended(path: String) { inner class Prepended(path: String) {
val path = "$path." val path = "$path."
constructor(vararg path: String) : this(path.joinToString(".")) constructor(vararg path: String) : this(path.joinToString("."))
@ -123,7 +118,6 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
inner class Colors( inner class Colors(
language: String, language: String,
val lowercaseIntermediate: Boolean,
val white: String, val white: String,
val orange: String, val orange: String,
@ -144,7 +138,86 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
) { ) {
val slave: LanguageProvider = slaves.computeIfAbsent(language, ::Slave) val slave: LanguageProvider = slaves.computeIfAbsent(language, ::Slave)
val mapped: Map<DyeColor, String> = ImmutableMap.builder<DyeColor, String>() val list: List<String> = ImmutableList.builder<String>()
.add(white)
.add(orange)
.add(magenta)
.add(lightBlue)
.add(yellow)
.add(lime)
.add(pink)
.add(gray)
.add(lightGray)
.add(cyan)
.add(purple)
.add(blue)
.add(brown)
.add(green)
.add(red)
.add(black)
.build()
val pairList: List<Pair<String, String>> = ImmutableList.builder<Pair<String, String>>()
.add("white" to white)
.add("orange" to orange)
.add("magenta" to magenta)
.add("light_blue" to lightBlue)
.add("yellow" to yellow)
.add("lime" to lime)
.add("pink" to pink)
.add("gray" to gray)
.add("light_gray" to lightGray)
.add("cyan" to cyan)
.add("purple" to purple)
.add("blue" to blue)
.add("brown" to brown)
.add("green" to green)
.add("red" to red)
.add("black" to black)
.build()
val mapped: Map<String, String> = ImmutableMap.builder<String, String>()
.put("white", white)
.put("orange", orange)
.put("magenta", magenta)
.put("lightBlue", lightBlue)
.put("light_blue", lightBlue)
.put("yellow", yellow)
.put("lime", lime)
.put("pink", pink)
.put("gray", gray)
.put("lightGray", lightGray)
.put("light_gray", lightGray)
.put("cyan", cyan)
.put("purple", purple)
.put("blue", blue)
.put("brown", brown)
.put("green", green)
.put("red", red)
.put("black", black)
.put("WHITE", white)
.put("ORANGE", orange)
.put("MAGENTA", magenta)
.put("LIGHTBLUE", lightBlue)
.put("LIGHT_BLUE", lightBlue)
.put("YELLOW", yellow)
.put("LIME", lime)
.put("PINK", pink)
.put("GRAY", gray)
.put("LIGHTGRAY", lightGray)
.put("LIGHT_GRAY", lightGray)
.put("CYAN", cyan)
.put("PURPLE", purple)
.put("BLUE", blue)
.put("BROWN", brown)
.put("GREEN", green)
.put("RED", red)
.put("BLACK", black)
.build()
val dyeClassMapped: Map<DyeColor, String> = ImmutableMap.builder<DyeColor, String>()
.put(DyeColor.WHITE, white) .put(DyeColor.WHITE, white)
.put(DyeColor.ORANGE, orange) .put(DyeColor.ORANGE, orange)
.put(DyeColor.MAGENTA, magenta) .put(DyeColor.MAGENTA, magenta)
@ -163,30 +236,37 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
.put(DyeColor.BLACK, black) .put(DyeColor.BLACK, black)
.build() .build()
fun add(list: ColoredDecorativeBlock<*>, toFormat: String) { val dyeClassPairs: List<Pair<DyeColor, String>> = ImmutableList.builder<Pair<DyeColor, String>>()
for ((color, target) in mapped) { .add(DyeColor.WHITE to white)
.add(DyeColor.ORANGE to orange)
.add(DyeColor.MAGENTA to magenta)
.add(DyeColor.LIGHT_BLUE to lightBlue)
.add(DyeColor.YELLOW to yellow)
.add(DyeColor.LIME to lime)
.add(DyeColor.PINK to pink)
.add(DyeColor.GRAY to gray)
.add(DyeColor.LIGHT_GRAY to lightGray)
.add(DyeColor.CYAN to cyan)
.add(DyeColor.PURPLE to purple)
.add(DyeColor.BLUE to blue)
.add(DyeColor.BROWN to brown)
.add(DyeColor.GREEN to green)
.add(DyeColor.RED to red)
.add(DyeColor.BLACK to black)
.build()
fun add(list: ColoredDecorativeBlock, toFormat: String) {
for ((color, target) in dyeClassPairs) {
slave.add(list.blocks[color]!!, toFormat.format(target)) slave.add(list.blocks[color]!!, toFormat.format(target))
} }
} }
fun forEach(consumer: (color: DyeColor, name: String) -> Unit) { fun forEach(consumer: (color: DyeColor, name: String) -> Unit) {
for ((a, b) in mapped) { for ((a, b) in dyeClassPairs) {
consumer.invoke(a, b) consumer.invoke(a, b)
} }
} }
fun add(map: Map<in DyeColor, Block>, toFormat: String) {
for ((color, block) in map) {
slave.add(block, toFormat.format(mapped[color]!!))
}
}
fun addIntermediate(map: Map<in DyeColor, Block>, toFormat: String) {
for ((color, block) in map) {
slave.add(block, toFormat.format(if (lowercaseIntermediate) mapped[color]!!.lowercase() else mapped[color]!!))
}
}
fun add( fun add(
whiteBlock: Block, whiteBlock: Block,
orangeBlock: Block, orangeBlock: Block,
@ -262,9 +342,55 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
slave.add(redItem, toFormat.format(red)) slave.add(redItem, toFormat.format(red))
slave.add(blackItem, toFormat.format(black)) slave.add(blackItem, toFormat.format(black))
} }
fun addBlocks(list: List<Block>, toFormat: String) {
add(
whiteBlock = list[0],
orangeBlock = list[1],
magentaBlock = list[2],
lightBlueBlock = list[3],
yellowBlock = list[4],
limeBlock = list[5],
pinkBlock = list[6],
grayBlock = list[7],
lightGrayBlock = list[8],
cyanBlock = list[9],
purpleBlock = list[10],
blueBlock = list[11],
brownBlock = list[12],
greenBlock = list[13],
redBlock = list[14],
blackBlock = list[15],
toFormat = toFormat
)
} }
val englishColors = Colors("en_us", lowercaseIntermediate = false, fun addItems(list: List<Item>, toFormat: String) {
add(
whiteItem = list[0],
orangeItem = list[1],
magentaItem = list[2],
lightBlueItem = list[3],
yellowItem = list[4],
limeItem = list[5],
pinkItem = list[6],
grayItem = list[7],
lightGrayItem = list[8],
cyanItem = list[9],
purpleItem = list[10],
blueItem = list[11],
brownItem = list[12],
greenItem = list[13],
redItem = list[14],
blackItem = list[15],
toFormat = toFormat
)
}
}
val englishColors = Colors("en_us",
"White", "White",
"Orange", "Orange",
"Magenta", "Magenta",
@ -283,18 +409,18 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
"Black", "Black",
) )
val russianColors = Colors("ru_ru", lowercaseIntermediate = true, val russianColors = Colors("ru_ru",
"Белый", "Белый",
"Оранжевый", "Оранжевый",
"Пурпурный", "Маджентовый",
"Голубой", "Светло Синий",
"Жёлтый", "Жёлтый",
"Лаймовый", "Лаймовый",
"Розовый", "Розовый",
"Серый", "Серый",
"Светло-серый", "Светло Серый",
"Бирюзовый", "Циановый",
"Фиолетовый", "Пурпурный",
"Синий", "Синий",
"Коричневый", "Коричневый",
"Зелёный", "Зелёный",

File diff suppressed because it is too large Load Diff

View File

@ -1,53 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.world.item.Items
import net.minecraft.world.level.storage.loot.entries.LootItem
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import ru.dbotthepony.mc.otm.datagen.modLootTable
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addAdvancementLoot(lootTables: LootTables) {
lootTables.builder(LootContextParamSets.ADVANCEMENT_ENTITY, modLootTable("research_all_android")) {
lootPool {
add(LootItem.lootTableItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_HUGE))
}
}
lootTables.builder(LootContextParamSets.ADVANCEMENT_ENTITY, modLootTable("tritanium_block3")) {
lootPool { item(Items.WHITE_DYE) { setCount(8) } }
lootPool { item(Items.ORANGE_DYE) { setCount(8) } }
lootPool { item(Items.MAGENTA_DYE) { setCount(8) } }
lootPool { item(Items.LIGHT_BLUE_DYE) { setCount(8) } }
lootPool { item(Items.YELLOW_DYE) { setCount(8) } }
lootPool { item(Items.LIME_DYE) { setCount(8) } }
lootPool { item(Items.PINK_DYE) { setCount(8) } }
lootPool { item(Items.GRAY_DYE) { setCount(8) } }
lootPool { item(Items.LIGHT_GRAY_DYE) { setCount(8) } }
lootPool { item(Items.CYAN_DYE) { setCount(8) } }
lootPool { item(Items.PURPLE_DYE) { setCount(8) } }
lootPool { item(Items.BLUE_DYE) { setCount(8) } }
lootPool { item(Items.BROWN_DYE) { setCount(8) } }
lootPool { item(Items.GREEN_DYE) { setCount(8) } }
lootPool { item(Items.RED_DYE) { setCount(8) } }
lootPool { item(Items.BLACK_DYE) { setCount(8) } }
}
lootTables.builder(LootContextParamSets.ADVANCEMENT_ENTITY, modLootTable("tritanium_block4")) {
lootPool { item(Items.WHITE_DYE) { setCount(64) } }
lootPool { item(Items.ORANGE_DYE) { setCount(64) } }
lootPool { item(Items.MAGENTA_DYE) { setCount(64) } }
lootPool { item(Items.LIGHT_BLUE_DYE) { setCount(64) } }
lootPool { item(Items.YELLOW_DYE) { setCount(64) } }
lootPool { item(Items.LIME_DYE) { setCount(64) } }
lootPool { item(Items.PINK_DYE) { setCount(64) } }
lootPool { item(Items.GRAY_DYE) { setCount(64) } }
lootPool { item(Items.LIGHT_GRAY_DYE) { setCount(64) } }
lootPool { item(Items.CYAN_DYE) { setCount(64) } }
lootPool { item(Items.PURPLE_DYE) { setCount(64) } }
lootPool { item(Items.BLUE_DYE) { setCount(64) } }
lootPool { item(Items.BROWN_DYE) { setCount(64) } }
lootPool { item(Items.GREEN_DYE) { setCount(64) } }
lootPool { item(Items.RED_DYE) { setCount(64) } }
lootPool { item(Items.BLACK_DYE) { setCount(64) } }
}
}

View File

@ -1,88 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.MRegistry
fun addDecorativeLoot(lootTables: LootTables) {
lootTables.dropsSelf(MRegistry.DECORATIVE_CRATE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.COMPUTER_TERMINAL.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.STAR_CHAIR.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.CARGO_CRATES.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_BLOCK.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_WALL.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STAIRS.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MRegistry.TRITANIUM_SLAB.allBlocks.values)
lootTables.dropsSelf(MRegistry.VENT.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.VENT_ALTERNATIVE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.FLOOR_TILES.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.UNREFINED_FLOOR_TILES.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_BLOCK.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.FLOOR_TILES_STAIRS.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MRegistry.FLOOR_TILES_SLAB.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.CARBON_FIBRE_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.METAL_MESH) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.METAL_RAILING) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.METAL_JUNK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_RAW_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_BLOCK.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_WALL.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_STAIRS.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MBlocks.TRITANIUM_STRIPED_SLAB.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.LABORATORY_LAMP) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.LABORATORY_LAMP_INVERTED) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.DANGER_STRIPE_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.METAL_BEAM) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_INGOT_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_BARS) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.WITHERED_STEEL_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_HULL) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.GENERATOR_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.MODULAR_FRAME) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.HEAVY_MODULAR_FRAME) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.FLYWHEEL_SHAFT) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.FLYWHEEL_HOUSING) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.FLYWHEEL_BEARING) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.ENGINE) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.REDSTONE_LAMP_INVERTED) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.REINFORCED_REDSTONE_LAMP) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.REINFORCED_REDSTONE_LAMP_INVERTED) { condition(ExplosionCondition.survivesExplosion()) }
MBlocks.TRITANIUM_ANVIL.values.forEach { it.forEach { lootTables.dropsSelf(it) { condition(ExplosionCondition.survivesExplosion()) } } }
for (door in MBlocks.TRITANIUM_TRAPDOOR.values)
lootTables.dropsSelf(door) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
for (door in MBlocks.TRITANIUM_DOOR.values) {
lootTables.block(door) {
item(door) {
blockStateCondition(door) {
this[BlockStateProperties.DOUBLE_BLOCK_HALF] = DoubleBlockHalf.LOWER
}
}
condition(ExplosionCondition.survivesExplosion())
}
}
}

View File

@ -1,32 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.world.level.storage.loot.functions.SetComponentsFunction
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import ru.dbotthepony.mc.otm.datagen.modLootTable
import ru.dbotthepony.mc.otm.registry.game.MDataComponentTypes
import ru.dbotthepony.mc.otm.registry.game.MEntityTypes
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addEntityLoot(loot: LootTables) {
loot.builder(LootContextParamSets.ENTITY, modLootTable("entities/loader")) {
lootPool {
item(MItems.MECHANICAL_PARTS) {
setCount(1, 3)
setWeight(7)
}
item(MItems.ELECTRIC_PARTS) {
setCount(1, 1)
setWeight(1)
}
setRolls(1)
}
}
loot.builder(LootContextParamSets.ENTITY, MEntityTypes.BREAD_MONSTER.defaultLootTable) {
lootPool {
item(MItems.IMPERFECT_BREAD) {
apply(SetComponentsFunction.setComponent(MDataComponentTypes.INERT, true))
}
}
}
}

View File

@ -1,9 +1,9 @@
package ru.dbotthepony.mc.otm.datagen.loot package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.data.DataGenerator
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.neoforged.neoforge.common.data.GlobalLootModifierProvider import net.minecraftforge.common.data.GlobalLootModifierProvider
import net.neoforged.neoforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.data.loot.LootPoolAppender import ru.dbotthepony.mc.otm.data.loot.LootPoolAppender
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import java.util.Arrays import java.util.Arrays
@ -51,7 +51,7 @@ fun PlainLootAppender(
vararg items: Pair<ItemStack, Double> vararg items: Pair<ItemStack, Double>
) = PlainLootAppender(conditions, Arrays.stream(items)) ) = PlainLootAppender(conditions, Arrays.stream(items))
class LootModifiers(generator: GatherDataEvent) : GlobalLootModifierProvider(generator.generator.packOutput, generator.lookupProvider, DataGen.MOD_ID) { class LootModifiers(generator: DataGenerator) : GlobalLootModifierProvider(generator.packOutput, DataGen.MOD_ID) {
private val lambdas = ArrayList<(LootModifiers) -> Unit>() private val lambdas = ArrayList<(LootModifiers) -> Unit>()
fun lambda(lambda: (LootModifiers) -> Unit) { fun lambda(lambda: (LootModifiers) -> Unit) {

View File

@ -1,30 +1,23 @@
package ru.dbotthepony.mc.otm.datagen.loot package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.util.valueproviders.UniformInt import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.entity.EntityType import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Rarity
import net.minecraft.world.level.storage.loot.BuiltInLootTables import net.minecraft.world.level.storage.loot.BuiltInLootTables
import net.minecraft.world.level.storage.loot.LootTable
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.neoforged.neoforge.common.loot.AddTableLootModifier import net.minecraftforge.common.loot.LootTableIdCondition
import net.neoforged.neoforge.common.loot.LootTableIdCondition import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.util.ResourceLocation import ru.dbotthepony.mc.otm.data.UniformDecimal
import ru.dbotthepony.mc.otm.util.math.Decimal
import ru.dbotthepony.mc.otm.data.world.UniformDecimal
import ru.dbotthepony.mc.otm.data.condition.ChanceWithPlaytimeCondition import ru.dbotthepony.mc.otm.data.condition.ChanceWithPlaytimeCondition
import ru.dbotthepony.mc.otm.data.condition.HasExoPackCondition import ru.dbotthepony.mc.otm.data.condition.HasExoPackCondition
import ru.dbotthepony.mc.otm.data.condition.ItemInInventoryCondition import ru.dbotthepony.mc.otm.data.condition.ItemInInventoryCondition
import ru.dbotthepony.mc.otm.data.condition.KilledByRealPlayerOrIndirectly import ru.dbotthepony.mc.otm.data.condition.KilledByRealPlayerOrIndirectly
import ru.dbotthepony.mc.otm.data.loot.LootPoolAppender import ru.dbotthepony.mc.otm.data.loot.LootPoolAppender
import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.datagen.modLootTable
import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem
import ru.dbotthepony.mc.otm.item.exopack.ProceduralExopackSlotUpgradeItem import ru.dbotthepony.mc.otm.item.exopack.ProceduralExoPackSlotUpgradeItem
import ru.dbotthepony.mc.otm.item.matter.GoldDiskItem import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.game.MItems
@Suppress("FunctionName") @Suppress("FunctionName")
fun LootTableIdCondition(location: String): LootItemCondition { fun LootTableIdCondition(location: String): LootItemCondition {
@ -36,23 +29,18 @@ fun LootTableIdCondition(location: ResourceLocation): LootItemCondition {
return LootTableIdCondition.Builder(location).build() return LootTableIdCondition.Builder(location).build()
} }
@Suppress("FunctionName")
fun LootTableIdCondition(location: ResourceKey<LootTable>): LootItemCondition {
return LootTableIdCondition.Builder(location.location()).build()
}
fun addLootModifiers(it: LootModifiers) { fun addLootModifiers(it: LootModifiers) {
it.add("dungeon_exopack", LootPoolAppender( it.add("dungeon_exopack", LootPoolAppender(
arrayOf(LootTableIdCondition(BuiltInLootTables.SIMPLE_DUNGEON)), arrayOf(LootTableIdCondition(BuiltInLootTables.SIMPLE_DUNGEON)),
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.2) chanceCondition(0.2)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(6, 9))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(6, 9)))
}, },
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.05) chanceCondition(0.05)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18)))
}, },
)) ))
@ -61,17 +49,12 @@ fun addLootModifiers(it: LootModifiers) {
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1) chanceCondition(0.1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(4, 8))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(4, 8)))
}, },
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1) chanceCondition(0.1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(4, 10))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(4, 10)))
},
singleItem(MItems.GOLD_DISK) {
chanceCondition(0.1)
apply(GoldDiskItem.patterns(DataGen.random, MItems.IMPERFECT_BREAD))
}, },
singleItem(MItems.PROCEDURAL_BATTERY) { singleItem(MItems.PROCEDURAL_BATTERY) {
@ -90,12 +73,12 @@ fun addLootModifiers(it: LootModifiers) {
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1) chanceCondition(0.1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(12, 18))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(12, 18)))
}, },
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.25) chanceCondition(0.25)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(4, 9))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(4, 9)))
}, },
)) ))
@ -104,12 +87,12 @@ fun addLootModifiers(it: LootModifiers) {
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.15) chanceCondition(0.15)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18)))
}, },
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.35) chanceCondition(0.35)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(16, 28), UniformInt.of(2, 6))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(16, 28), UniformInt.of(2, 6)))
}, },
)) ))
@ -118,22 +101,17 @@ fun addLootModifiers(it: LootModifiers) {
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.4) chanceCondition(0.4)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18)))
}, },
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.2) chanceCondition(0.2)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(14, 27), UniformInt.of(2, 6))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(14, 27), UniformInt.of(2, 6)))
}, },
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) { singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1) chanceCondition(0.1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(27, 56), UniformInt.of(2, 6))) apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(27, 56), UniformInt.of(2, 6)))
},
singleItem(MItems.GOLD_DISK) {
chanceCondition(0.15)
apply(GoldDiskItem.patterns(DataGen.random, Items.ENDER_PEARL))
}, },
)) ))
@ -142,7 +120,6 @@ fun addLootModifiers(it: LootModifiers) {
ItemStack(MItems.PILL_ANDROID, 1) to 0.1, ItemStack(MItems.PILL_ANDROID, 1) to 0.1,
ItemStack(MItems.PILL_HEAL, 2) to 0.5, ItemStack(MItems.PILL_HEAL, 2) to 0.5,
ItemStack(MItems.PILL_HEAL, 1) to 0.75, ItemStack(MItems.PILL_HEAL, 1) to 0.75,
ItemStack(MItems.PILL_NOT_NORMAL, 3) to 0.25,
)) ))
it.add("mineshaft_pill", PlainLootAppender( it.add("mineshaft_pill", PlainLootAppender(
@ -150,7 +127,6 @@ fun addLootModifiers(it: LootModifiers) {
ItemStack(MItems.PILL_ANDROID, 1) to 0.04, ItemStack(MItems.PILL_ANDROID, 1) to 0.04,
ItemStack(MItems.PILL_HEAL, 2) to 0.1, ItemStack(MItems.PILL_HEAL, 2) to 0.1,
ItemStack(MItems.PILL_HEAL, 1) to 0.4, ItemStack(MItems.PILL_HEAL, 1) to 0.4,
ItemStack(MItems.PILL_NOT_NORMAL, 3) to 0.25,
)) ))
it.add("mineshaft_nutrient_paste", PlainLootAppender( it.add("mineshaft_nutrient_paste", PlainLootAppender(
@ -164,13 +140,11 @@ fun addLootModifiers(it: LootModifiers) {
arrayOf(LootTableIdCondition(BuiltInLootTables.DESERT_PYRAMID)), arrayOf(LootTableIdCondition(BuiltInLootTables.DESERT_PYRAMID)),
ItemStack(MItems.PILL_ANDROID, 1) to 0.15, ItemStack(MItems.PILL_ANDROID, 1) to 0.15,
ItemStack(MItems.PILL_HEAL, 1) to 0.3, ItemStack(MItems.PILL_HEAL, 1) to 0.3,
ItemStack(MItems.PILL_NOT_NORMAL, 3) to 0.25,
)) ))
it.add("jungle_temple_pill", PlainLootAppender( it.add("jungle_temple_pill", PlainLootAppender(
arrayOf(LootTableIdCondition(BuiltInLootTables.JUNGLE_TEMPLE)), arrayOf(LootTableIdCondition(BuiltInLootTables.JUNGLE_TEMPLE)),
ItemStack(MItems.PILL_ANDROID, 1) to 0.5, ItemStack(MItems.PILL_ANDROID, 1) to 0.5
ItemStack(MItems.PILL_NOT_NORMAL, 8) to 0.2,
)) ))
it.add("end_city_modifications", PlainLootAppender( it.add("end_city_modifications", PlainLootAppender(
@ -178,8 +152,7 @@ fun addLootModifiers(it: LootModifiers) {
ItemStack(MItems.PILL_ANDROID, 1) to 0.15, ItemStack(MItems.PILL_ANDROID, 1) to 0.15,
ItemStack(MItems.PILL_HUMANE, 1) to 0.3, ItemStack(MItems.PILL_HUMANE, 1) to 0.3,
ItemStack(MItems.PILL_OBLIVION, 1) to 0.5, ItemStack(MItems.PILL_OBLIVION, 1) to 0.5,
ItemStack(MItems.ZPM_BATTERY, 1) to 0.004, ItemStack(MItems.ZPM_BATTERY, 1) to 0.005,
ItemStack(MItems.ANTIMATTER_TRANSFORM_MATRIX, 1) to 0.5,
)) ))
it.add("shipwreck_supply_pill", PlainLootAppender( it.add("shipwreck_supply_pill", PlainLootAppender(
@ -189,7 +162,6 @@ fun addLootModifiers(it: LootModifiers) {
ItemStack(MItems.PILL_HEAL, 1) to 0.6, ItemStack(MItems.PILL_HEAL, 1) to 0.6,
ItemStack(MItems.PILL_HEAL, 1) to 0.6, ItemStack(MItems.PILL_HEAL, 1) to 0.6,
ItemStack(MItems.PILL_HEAL, 1) to 0.6, ItemStack(MItems.PILL_HEAL, 1) to 0.6,
ItemStack(MItems.PILL_NOT_NORMAL, 4) to 0.25,
)) ))
it.add("shipwreck_supply_nutrient_paste", PlainLootAppender( it.add("shipwreck_supply_nutrient_paste", PlainLootAppender(
@ -217,16 +189,6 @@ fun addLootModifiers(it: LootModifiers) {
ItemStack(MItems.EXOPACK_PROBE) ItemStack(MItems.EXOPACK_PROBE)
)) ))
it.add("withered_skeleton_steel_drop", PlainLootAppender(
arrayOf(
LootTableIdCondition(EntityType.WITHER_SKELETON.defaultLootTable),
KilledByRealPlayerOrIndirectly
),
ItemStack(MItems.WITHERED_STEEL, 1) to 0.15,
ItemStack(MItems.WITHERED_STEEL, 2) to 0.1
))
it.add("wither_exosuit_upgrades", BasicLootAppender( it.add("wither_exosuit_upgrades", BasicLootAppender(
arrayOf( arrayOf(
LootTableIdCondition(EntityType.WITHER.defaultLootTable), LootTableIdCondition(EntityType.WITHER.defaultLootTable),
@ -242,29 +204,4 @@ fun addLootModifiers(it: LootModifiers) {
), ),
ItemStack(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON), ItemStack(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON),
)) ))
it.add("trials/matter_dust", AddTableLootModifier(
arrayOf(LootTableIdCondition(BuiltInLootTables.TRIAL_CHAMBERS_REWARD)),
modLootTable("trials/matter_dust")
))
it.add("trials/pill", AddTableLootModifier(
arrayOf(LootTableIdCondition(BuiltInLootTables.TRIAL_CHAMBERS_REWARD)),
modLootTable("trials/pill")
))
it.add("trials/exosuit", AddTableLootModifier(
arrayOf(LootTableIdCondition(BuiltInLootTables.TRIAL_CHAMBERS_REWARD)),
modLootTable("trials/exosuit")
))
it.add("trials/battery", AddTableLootModifier(
arrayOf(LootTableIdCondition(BuiltInLootTables.TRIAL_CHAMBERS_REWARD)),
modLootTable("trials/battery")
))
it.add("trials/zpm_battery", AddTableLootModifier(
arrayOf(LootTableIdCondition(BuiltInLootTables.TRIAL_CHAMBERS_REWARD_OMINOUS)),
modLootTable("trials/zpm_battery")
))
} }

View File

@ -6,12 +6,10 @@ package ru.dbotthepony.mc.otm.datagen.loot
import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap import it.unimi.dsi.fastutil.objects.Reference2ObjectArrayMap
import it.unimi.dsi.fastutil.objects.Reference2ObjectFunction import it.unimi.dsi.fastutil.objects.Reference2ObjectFunction
import net.minecraft.advancements.critereon.StatePropertiesPredicate import net.minecraft.advancements.critereon.StatePropertiesPredicate
import net.minecraft.core.HolderLookup import net.minecraft.data.DataGenerator
import net.minecraft.core.WritableRegistry
import net.minecraft.data.loot.LootTableProvider import net.minecraft.data.loot.LootTableProvider
import net.minecraft.data.loot.LootTableSubProvider import net.minecraft.data.loot.LootTableSubProvider
import net.minecraft.resources.ResourceKey import net.minecraft.resources.ResourceLocation
import net.minecraft.util.ProblemReporter
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.SlabBlock import net.minecraft.world.level.block.SlabBlock
@ -21,31 +19,54 @@ import net.minecraft.world.level.storage.loot.LootTable
import net.minecraft.world.level.storage.loot.ValidationContext import net.minecraft.world.level.storage.loot.ValidationContext
import net.minecraft.world.level.storage.loot.entries.LootItem import net.minecraft.world.level.storage.loot.entries.LootItem
import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer import net.minecraft.world.level.storage.loot.entries.LootPoolSingletonContainer
import net.minecraft.world.level.storage.loot.functions.CopyNbtFunction
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet import net.minecraft.world.level.storage.loot.parameters.LootContextParamSet
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition import net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue import net.minecraft.world.level.storage.loot.providers.number.ConstantValue
import net.neoforged.neoforge.data.event.GatherDataEvent import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.kommons.collect.stream import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity
import ru.dbotthepony.mc.otm.core.stream
import ru.dbotthepony.mc.otm.data.loot.CopyTileNbtFunction import ru.dbotthepony.mc.otm.data.loot.CopyTileNbtFunction
import java.util.concurrent.CompletableFuture
class LootTables(generator: GatherDataEvent) : LootTableProvider(generator.generator.packOutput, setOf() /* because we don't fucking validate you fuck */, listOf() /* because we attach everything after class is constructed duh */, generator.lookupProvider) { data class NbtCopy(val source: String, val destination: String, val strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE)
private val providersTable = Reference2ObjectArrayMap<LootContextParamSet, HashMap<ResourceKey<LootTable>, () -> LootTable.Builder>>()
val registry: CompletableFuture<HolderLookup.Provider> = generator.lookupProvider
fun builder(context: LootContextParamSet, id: ResourceKey<LootTable>, provider: LootTable.Builder.() -> Unit) { fun TileNbtCopy(source: String, strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE): NbtCopy {
return NbtCopy(source, "BlockEntityTag.$source", strategy)
}
private val basicTags = arrayOf(
TileNbtCopy(MatteryBlockEntity.REDSTONE_CONTROL_KEY),
)
private val poweredTags = arrayOf(
*basicTags,
TileNbtCopy(MatteryBlockEntity.ENERGY_KEY),
TileNbtCopy(MatteryBlockEntity.BATTERY_KEY),
)
private val workerTags = arrayOf(
*poweredTags,
TileNbtCopy(MatteryWorkerBlockEntity.JOB_KEY),
TileNbtCopy(MatteryWorkerBlockEntity.WORK_TICKS_KEY),
)
private val poweredMatterWorker = arrayOf(
*workerTags,
TileNbtCopy(MatteryBlockEntity.MATTER_STORAGE_KEY),
)
class LootTables(generator: DataGenerator) : LootTableProvider(generator.packOutput, setOf() /* because we don't fucking validate you fuck */, listOf() /* because we attach everything after class is constructed duh */) {
private val providersTable = Reference2ObjectArrayMap<LootContextParamSet, HashMap<ResourceLocation, () -> LootTable.Builder>>()
fun builder(context: LootContextParamSet, id: ResourceLocation, provider: LootTable.Builder.() -> Unit) {
provider(context, id) { provider(context, id) {
LootTable.lootTable().also(provider) LootTable.lootTable().also(provider)
} }
} }
fun builder(block: Block, provider: LootPool.Builder.() -> Unit) { fun provider(context: LootContextParamSet, id: ResourceLocation, provider: () -> LootTable.Builder) {
singleLootPool(LootContextParamSets.BLOCK, block.lootTable, provider)
}
fun provider(context: LootContextParamSet, id: ResourceKey<LootTable>, provider: () -> LootTable.Builder) {
check(providersTable check(providersTable
.computeIfAbsent(context, Reference2ObjectFunction { HashMap() }) .computeIfAbsent(context, Reference2ObjectFunction { HashMap() })
.put(id, provider) == null) { "Duplicate loot pool entry for $id" } .put(id, provider) == null) { "Duplicate loot pool entry for $id" }
@ -63,11 +84,7 @@ class LootTables(generator: GatherDataEvent) : LootTableProvider(generator.gener
}.toList() }.toList()
} }
override fun validate( override fun validate(map: MutableMap<ResourceLocation, LootTable>, validationtracker: ValidationContext) {}
writableregistry: WritableRegistry<LootTable>,
validationtracker: ValidationContext,
`problemreporter$collector`: ProblemReporter.Collector
) {}
fun createSlabItemTable(block: Block, configurator: LootPoolSingletonContainer.Builder<*>.() -> Unit = {}) { fun createSlabItemTable(block: Block, configurator: LootPoolSingletonContainer.Builder<*>.() -> Unit = {}) {
builder(LootContextParamSets.BLOCK, block.lootTable) { builder(LootContextParamSets.BLOCK, block.lootTable) {
@ -104,10 +121,9 @@ class LootTables(generator: GatherDataEvent) : LootTableProvider(generator.gener
} }
} }
fun singleLootPool(context: LootContextParamSet, id: ResourceKey<LootTable>, block: LootPool.Builder.() -> Unit) { fun singleLootPool(context: LootContextParamSet, id: ResourceLocation, block: LootPool.Builder.() -> Unit) {
builder(context, id) { builder(context, id) {
withPool(LootPool.lootPool().also(block)) withPool(LootPool.lootPool().also(block))
setRandomSequence(id.location())
} }
} }
@ -146,14 +162,4 @@ class LootTables(generator: GatherDataEvent) : LootTableProvider(generator.gener
}) })
} }
} }
fun tile(blocks: Collection<Block>, vararg filterTags: String) {
for (block in blocks) {
singleLootPool(LootContextParamSets.BLOCK, block.lootTable) {
add(LootItem.lootTableItem(block).also {
it.apply(CopyTileNbtFunction(filterTags.stream()))
})
}
}
}
} }

View File

@ -1,18 +1,14 @@
package ru.dbotthepony.mc.otm.datagen.loot package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.level.storage.loot.entries.LootItem
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import ru.dbotthepony.mc.otm.util.math.Decimal import net.minecraft.world.level.storage.loot.providers.number.ConstantValue
import ru.dbotthepony.mc.otm.data.world.UniformDecimal import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.datagen.modLootTable import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem
import ru.dbotthepony.mc.otm.item.exopack.ProceduralExopackSlotUpgradeItem
import ru.dbotthepony.mc.otm.item.matter.MatterDustItem
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addChestLootTables(loot: LootTables) { fun addChestLootTables(loot: LootTables) {
loot.builder(LootContextParamSets.CHEST, modLootTable("food_box")) { loot.builder(LootContextParamSets.CHEST, modLocation("food_box")) {
lootPool { lootPool {
item(Items.PACKED_ICE) { setCount(minimal = 1, maximal = 3) } item(Items.PACKED_ICE) { setCount(minimal = 1, maximal = 3) }
item(MItems.NUTRIENT_PASTE) { setCount(minimal = 1, maximal = 2) } item(MItems.NUTRIENT_PASTE) { setCount(minimal = 1, maximal = 2) }
@ -21,106 +17,4 @@ fun addChestLootTables(loot: LootTables) {
setRolls(3) setRolls(3)
} }
} }
loot.builder(LootContextParamSets.CHEST, modLootTable("salvage_crate")) {
lootPool {
item(MItems.MECHANICAL_PARTS) { setCount(minimal = 2, maximal = 3) }
item(MItems.IRON_PLATE) { setCount(minimal = 2, maximal = 3) }
item(MItems.ELECTRIC_PARTS) { setCount(minimal = 2, maximal = 3) }
item(MItems.MECHANICAL_PARTS) { setCount(minimal = 2, maximal = 3) }
item(MItems.CIRCUIT_PLATING) { setCount(minimal = 1, maximal = 3) }
item(MItems.METAL_JUNK) { setCount(minimal = 3, maximal = 5) }
item(Items.COPPER_INGOT) { setCount(minimal = 1, maximal = 3) }
item(Items.EXPOSED_COPPER) { setCount(minimal = 1, maximal = 2) }
item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1)
setWeight(1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(1, 9), UniformInt.of(0, 3)))
}
setRolls(7)
}
}
loot.builder(LootContextParamSets.CHEST, modLootTable("frigate_cargo")) {
lootPool {
item(Items.IRON_INGOT) {
setCount(minimal = 1, maximal = 3)
setWeight(3)
}
item(Items.GOLD_INGOT) { setCount(minimal = 1, maximal = 3) }
item(Items.EMERALD) { setCount(minimal = 1, maximal = 3) }
item(MItems.TRITANIUM_INGOT) { setCount(minimal = 1, maximal = 3) }
item(MItems.MECHANICAL_PARTS) {
setCount(minimal = 2, maximal = 3)
setWeight(2)
}
item(MItems.CIRCUIT_PLATING) { setCount(minimal = 2, maximal = 3) }
item(MItems.ENERGY_BUS) { setCount(minimal = 0, maximal = 2) }
item(MItems.ROFLITE_ALLOY_INGOT) { setCount(minimal = 0, maximal = 3) }
item(MItems.WITHERED_STEEL) { setCount(minimal = 0, maximal = 3) }
item(Items.SADDLE) { setCount(minimal = 0, maximal = 1) }
item(Items.DIAMOND) { setCount(minimal = 0, maximal = 3) }
item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.2)
setWeight(3)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(1, 9), UniformInt.of(0, 3)))
}
item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1)
setWeight(2)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18), UniformInt.of(0, 3)))
}
item(MItems.PROCEDURAL_BATTERY) {
chanceCondition(0.05)
setWeight(1)
apply(
ProceduralBatteryItem.Randomizer(
maxBatteryLevel = UniformDecimal(Decimal(10_000_000), Decimal(50_000_000)),
batteryLevel = UniformDecimal(Decimal(0), Decimal(25_000_000)),
maxInput = UniformDecimal(Decimal(1_000), Decimal(5_000)),
))
}
item(MItems.ZPM_BATTERY) {
chanceCondition(0.001)
setWeight(1)
}
item(MItems.MATTER_DUST) {
chanceCondition(0.1)
setWeight(4)
apply(MatterDustItem.Randomizer(UniformDecimal(Decimal(100), Decimal(2_500))))
}
setRolls(12)
}
}
loot.builder(LootContextParamSets.CHEST, modLootTable("laboratory/supply")) {
lootPool {
item(Items.BREAD) { setCount(minimal = 2, maximal = 3) }
item(Items.HONEY_BOTTLE) { setCount(minimal = 1, maximal = 2) }
item(MItems.NUTRIENT_PASTE) { setCount(minimal = 2, maximal = 3) }
item(Items.SNOWBALL) { setCount(minimal = 1, maximal = 5) }
item(Items.PACKED_ICE) { setCount(minimal = 2, maximal = 3) }
setRolls(7)
}
}
loot.builder(LootContextParamSets.CHEST, modLootTable("laboratory/reward")) {
lootPool {
item(MItems.NUTRIENT_PASTE) { setCount(minimal = 2, maximal = 3) }
setRolls(5)
}
}
} }

View File

@ -1,61 +1,159 @@
package ru.dbotthepony.mc.otm.datagen.loot package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.advancements.critereon.EnchantmentPredicate import net.minecraft.world.item.Items
import net.minecraft.advancements.critereon.ItemEnchantmentsPredicate import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.advancements.critereon.ItemPredicate import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.minecraft.advancements.critereon.ItemSubPredicates
import net.minecraft.advancements.critereon.MinMaxBounds
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.item.enchantment.Enchantments
import net.minecraft.world.level.ItemLike
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.storage.loot.entries.AlternativesEntry
import net.minecraft.world.level.storage.loot.entries.LootItem import net.minecraft.world.level.storage.loot.entries.LootItem
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction
import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition
import net.minecraft.world.level.storage.loot.predicates.MatchTool import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.util.lookupOrThrow import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.data.loot.Int2NumberProvider import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.game.MBlocks import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.registry.game.MItems
private fun ore(lootTables: LootTables, ore: Block, clump: ItemLike, count: Int = 1) {
lootTables.builder(ore) {
add(AlternativesEntry.alternatives(
LootItem.lootTableItem(ore).also {
it.condition(MatchTool.toolMatches(
ItemPredicate.Builder.item().withSubPredicate(
ItemSubPredicates.ENCHANTMENTS,
ItemEnchantmentsPredicate.enchantments(listOf(EnchantmentPredicate(
lootTables.registry.get().lookupOrThrow(Enchantments.SILK_TOUCH), MinMaxBounds.Ints.atLeast(1)
)))
)
))
},
LootItem.lootTableItem(clump).also {
if (count != 1)
it.apply(SetItemCountFunction.setCount(Int2NumberProvider(UniformInt.of(1, count))))
it.apply(ApplyBonusCount.addOreBonusCount(lootTables.registry.get().lookupOrThrow(Enchantments.FORTUNE)))
it.condition(ExplosionCondition.survivesExplosion())
}
))
}
}
fun addLootTables(lootTables: LootTables) { fun addLootTables(lootTables: LootTables) {
lootTables.dropsSelf(MBlocks.MATTER_CABLE) { condition(ExplosionCondition.survivesExplosion()) } lootTables.dropsSelf(MRegistry.DECORATIVE_CRATE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.ENERGY_CABLES.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.CARGO_CRATES.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_BLOCK.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_WALL.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STAIRS.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MRegistry.TRITANIUM_SLAB.allBlocks.values)
lootTables.dropsSelf(MRegistry.VENT.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.VENT_ALTERNATIVE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.FLOOR_TILES.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.UNREFINED_FLOOR_TILES.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_BLOCK.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.FLOOR_TILES_STAIRS.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MRegistry.FLOOR_TILES_SLAB.blocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.CARBON_FIBRE_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_RAW_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_WALL) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_STRIPED_STAIRS) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.createSlabItemTable(MBlocks.TRITANIUM_STRIPED_SLAB) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.MATTER_CABLE) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.GRAVITATION_STABILIZER) lootTables.dropsSelf(MBlocks.GRAVITATION_STABILIZER)
lootTables.dropsOther(MBlocks.GRAVITATION_STABILIZER_LENS, MBlocks.GRAVITATION_STABILIZER) lootTables.dropsOther(MBlocks.GRAVITATION_STABILIZER_LENS, MBlocks.GRAVITATION_STABILIZER)
ore(lootTables, MBlocks.TRITANIUM_ORE, MItems.TRITANIUM_ORE_CLUMP) lootTables.dropsSelf(MBlocks.LABORATORY_LAMP) { condition(ExplosionCondition.survivesExplosion()) }
ore(lootTables, MBlocks.DEEPSLATE_TRITANIUM_ORE, MItems.TRITANIUM_ORE_CLUMP) lootTables.dropsSelf(MBlocks.LABORATORY_LAMP_INVERTED) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.DANGER_STRIPE_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.METAL_BEAM) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_INGOT_BLOCK) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.TRITANIUM_BARS) { condition(ExplosionCondition.survivesExplosion()) }
ore(lootTables, MBlocks.DILITHIUM_ORE, MItems.DILITHIUM_CRYSTAL, 2) lootTables.dropsSelf(MBlocks.ENGINE) { condition(ExplosionCondition.survivesExplosion()) }
ore(lootTables, MBlocks.DEEPSLATE_DILITHIUM_ORE, MItems.DILITHIUM_CRYSTAL, 2)
for (block in MBlocks.TRITANIUM_ANVIL)
lootTables.dropsSelf(block) { condition(ExplosionCondition.survivesExplosion()) }
for (door in MBlocks.TRITANIUM_TRAPDOOR.values)
lootTables.dropsSelf(door) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.block(MBlocks.PHANTOM_ATTRACTOR) {
item(MBlocks.PHANTOM_ATTRACTOR) {
blockStateCondition(MBlocks.PHANTOM_ATTRACTOR) {
this[BlockStateProperties.DOUBLE_BLOCK_HALF] = DoubleBlockHalf.LOWER
}
}
condition(ExplosionCondition.survivesExplosion())
}
for (door in MBlocks.TRITANIUM_DOOR.values) {
lootTables.block(door) {
item(door) {
blockStateCondition(door) {
this[BlockStateProperties.DOUBLE_BLOCK_HALF] = DoubleBlockHalf.LOWER
}
}
condition(ExplosionCondition.survivesExplosion())
}
}
lootTables.builder(LootContextParamSets.ADVANCEMENT_ENTITY, modLocation("research_all_android")) {
lootPool {
add(LootItem.lootTableItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_HUGE))
}
}
lootTables.builder(LootContextParamSets.ADVANCEMENT_ENTITY, modLocation("tritanium_block3")) {
lootPool { item(Items.WHITE_DYE) { setCount(8) } }
lootPool { item(Items.ORANGE_DYE) { setCount(8) } }
lootPool { item(Items.MAGENTA_DYE) { setCount(8) } }
lootPool { item(Items.LIGHT_BLUE_DYE) { setCount(8) } }
lootPool { item(Items.YELLOW_DYE) { setCount(8) } }
lootPool { item(Items.LIME_DYE) { setCount(8) } }
lootPool { item(Items.PINK_DYE) { setCount(8) } }
lootPool { item(Items.GRAY_DYE) { setCount(8) } }
lootPool { item(Items.LIGHT_GRAY_DYE) { setCount(8) } }
lootPool { item(Items.CYAN_DYE) { setCount(8) } }
lootPool { item(Items.PURPLE_DYE) { setCount(8) } }
lootPool { item(Items.BLUE_DYE) { setCount(8) } }
lootPool { item(Items.BROWN_DYE) { setCount(8) } }
lootPool { item(Items.GREEN_DYE) { setCount(8) } }
lootPool { item(Items.RED_DYE) { setCount(8) } }
lootPool { item(Items.BLACK_DYE) { setCount(8) } }
}
lootTables.builder(LootContextParamSets.ADVANCEMENT_ENTITY, modLocation("tritanium_block4")) {
lootPool { item(Items.WHITE_DYE) { setCount(64) } }
lootPool { item(Items.ORANGE_DYE) { setCount(64) } }
lootPool { item(Items.MAGENTA_DYE) { setCount(64) } }
lootPool { item(Items.LIGHT_BLUE_DYE) { setCount(64) } }
lootPool { item(Items.YELLOW_DYE) { setCount(64) } }
lootPool { item(Items.LIME_DYE) { setCount(64) } }
lootPool { item(Items.PINK_DYE) { setCount(64) } }
lootPool { item(Items.GRAY_DYE) { setCount(64) } }
lootPool { item(Items.LIGHT_GRAY_DYE) { setCount(64) } }
lootPool { item(Items.CYAN_DYE) { setCount(64) } }
lootPool { item(Items.PURPLE_DYE) { setCount(64) } }
lootPool { item(Items.BLUE_DYE) { setCount(64) } }
lootPool { item(Items.BROWN_DYE) { setCount(64) } }
lootPool { item(Items.GREEN_DYE) { setCount(64) } }
lootPool { item(Items.RED_DYE) { setCount(64) } }
lootPool { item(Items.BLACK_DYE) { setCount(64) } }
}
lootTables.tile(MBlocks.COBBLESTONE_GENERATOR)
lootTables.tile(MBlocks.ESSENCE_STORAGE)
lootTables.tile(MBlocks.MATTER_RECONSTRUCTOR)
lootTables.tile(MBlocks.FLUID_TANK)
lootTables.tile(MBlocks.ENERGY_SERVO)
lootTables.tile(MBlocks.ENERGY_COUNTER)
lootTables.tile(MBlocks.CHEMICAL_GENERATOR)
lootTables.tile(MBlocks.HOLO_SIGN, "isLocked")
lootTables.tile(MBlocks.STORAGE_CABLE)
lootTables.tile(MBlocks.ANDROID_STATION)
lootTables.tile(MBlocks.BATTERY_BANK)
lootTables.tile(MBlocks.DRIVE_VIEWER)
lootTables.tile(MBlocks.STORAGE_BUS)
lootTables.tile(MBlocks.STORAGE_IMPORTER)
lootTables.tile(MBlocks.STORAGE_EXPORTER)
lootTables.tile(MBlocks.STORAGE_POWER_SUPPLIER)
lootTables.tile(MBlocks.DRIVE_RACK)
lootTables.tile(MBlocks.MATTER_DECOMPOSER)
lootTables.tile(MBlocks.MATTER_REPLICATOR)
lootTables.tile(MBlocks.MATTER_RECYCLER)
lootTables.tile(MBlocks.MATTER_SCANNER)
lootTables.tile(MBlocks.PLATE_PRESS)
lootTables.tile(MBlocks.MATTER_PANEL)
lootTables.tile(MBlocks.PATTERN_STORAGE)
lootTables.tile(MBlocks.MATTER_CAPACITOR_BANK)
lootTables.tile(MBlocks.MATTER_BOTTLER)
} }

View File

@ -1,82 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.minecraft.world.level.block.state.properties.DoubleBlockHalf
import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition
import ru.dbotthepony.mc.otm.registry.game.MBlocks
fun addMachineLoot(lootTables: LootTables) {
lootTables.block(MBlocks.PHANTOM_ATTRACTOR) {
item(MBlocks.PHANTOM_ATTRACTOR) {
blockStateCondition(MBlocks.PHANTOM_ATTRACTOR) {
this[BlockStateProperties.DOUBLE_BLOCK_HALF] = DoubleBlockHalf.LOWER
}
}
condition(ExplosionCondition.survivesExplosion())
}
lootTables.dropsSelf(MBlocks.INFINITE_WATER_SOURCE) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.tile(MBlocks.COBBLESTONE_GENERATOR.values)
lootTables.tile(MBlocks.ESSENCE_STORAGE.values)
lootTables.tile(MBlocks.MATTER_RECONSTRUCTOR.values)
lootTables.tile(MBlocks.FLUID_TANK)
lootTables.tile(MBlocks.PAINTER)
lootTables.tile(MBlocks.MATTER_ENTANGLER)
lootTables.tile(MBlocks.GRILL.values)
lootTables.tile(MBlocks.ENERGY_SERVO.values)
lootTables.tile(MBlocks.ENERGY_COUNTER.values)
lootTables.tile(MBlocks.CHEMICAL_GENERATOR.values)
lootTables.tile(MBlocks.HOLO_SIGN, "isLocked")
lootTables.tile(MBlocks.STORAGE_CABLE)
lootTables.tile(MBlocks.ANDROID_STATION.values)
lootTables.tile(MBlocks.ANDROID_CHARGER.values)
lootTables.tile(MBlocks.BATTERY_BANK.values)
lootTables.tile(MBlocks.DRIVE_VIEWER.values)
lootTables.tile(MBlocks.STORAGE_BUS)
lootTables.tile(MBlocks.STORAGE_IMPORTER)
lootTables.tile(MBlocks.STORAGE_EXPORTER)
lootTables.tile(MBlocks.STORAGE_POWER_SUPPLIER.values)
lootTables.tile(MBlocks.DRIVE_RACK)
lootTables.tile(MBlocks.MATTER_DECOMPOSER.values)
lootTables.tile(MBlocks.MATTER_REPLICATOR.values)
lootTables.tile(MBlocks.MATTER_RECYCLER.values)
lootTables.tile(MBlocks.MATTER_SCANNER.values)
lootTables.tile(MBlocks.PLATE_PRESS.values)
lootTables.tile(MBlocks.TWIN_PLATE_PRESS.values)
lootTables.tile(MBlocks.POWERED_FURNACE.values)
lootTables.tile(MBlocks.POWERED_SMOKER.values)
lootTables.tile(MBlocks.POWERED_BLAST_FURNACE.values)
lootTables.tile(MBlocks.MATTER_PANEL.values)
lootTables.tile(MBlocks.PATTERN_STORAGE)
lootTables.tile(MBlocks.MATTER_CAPACITOR_BANK.values)
lootTables.tile(MBlocks.MATTER_BOTTLER.values)
lootTables.tile(MBlocks.BLACK_HOLE_GENERATOR)
lootTables.tile(MBlocks.FLYWHEEL_BATTERY)
lootTables.dropsSelf(listOf(
MBlocks.MATTER_INJECTOR,
MBlocks.ANTIMATTER_INJECTOR,
MBlocks.HIGH_ENERGY_PARTICLE_COLLECTOR
)) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.tile(MBlocks.ITEM_INPUT_HATCH)
lootTables.tile(MBlocks.ITEM_OUTPUT_HATCH)
lootTables.tile(MBlocks.ENERGY_INPUT_HATCH)
lootTables.tile(MBlocks.ENERGY_OUTPUT_HATCH)
lootTables.tile(MBlocks.MATTER_INPUT_HATCH)
lootTables.tile(MBlocks.MATTER_OUTPUT_HATCH)
lootTables.tile(MBlocks.ENERGY_INPUT_INTERFACE)
lootTables.tile(MBlocks.ENERGY_OUTPUT_INTERFACE)
}

View File

@ -1,70 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import ru.dbotthepony.mc.otm.util.math.Decimal
import ru.dbotthepony.mc.otm.data.world.UniformDecimal
import ru.dbotthepony.mc.otm.datagen.modLootTable
import ru.dbotthepony.mc.otm.item.ProceduralBatteryItem
import ru.dbotthepony.mc.otm.item.exopack.ProceduralExopackSlotUpgradeItem
import ru.dbotthepony.mc.otm.item.matter.MatterDustItem
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addVaultLoot(lootTables: LootTables) {
lootTables.builder(LootContextParamSets.VAULT, modLootTable("trials/matter_dust")) {
lootPool { item(MItems.MATTER_DUST) {
chanceCondition(0.2)
setWeight(4)
apply(MatterDustItem.Randomizer(UniformDecimal(Decimal(100), Decimal(2_500))))
} }
}
lootTables.builder(LootContextParamSets.VAULT, modLootTable("trials/pill")) {
lootPool { item(MItems.PILL_ANDROID) {
chanceCondition(0.1)
setWeight(1)
} }
lootPool { item(MItems.PILL_HEAL) {
chanceCondition(0.5)
setWeight(2)
setCount(2, 5)
} }
}
lootTables.builder(LootContextParamSets.VAULT, modLootTable("trials/exosuit")) {
lootPool { item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.2)
setWeight(2)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(1, 9), UniformInt.of(0, 3)))
} }
lootPool { item(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1)
setWeight(1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18), UniformInt.of(0, 3)))
} }
}
lootTables.builder(LootContextParamSets.VAULT, modLootTable("trials/battery")) {
lootPool { item(MItems.PROCEDURAL_BATTERY) {
chanceCondition(0.05)
setWeight(1)
apply(
ProceduralBatteryItem.Randomizer(
maxBatteryLevel = UniformDecimal(Decimal(10_000_000), Decimal(50_000_000)),
batteryLevel = UniformDecimal(Decimal(0), Decimal(25_000_000)),
maxInput = UniformDecimal(Decimal(1_000), Decimal(5_000)),
))
} }
}
lootTables.builder(LootContextParamSets.VAULT, modLootTable("trials/zpm_battery")) {
lootPool { item(MItems.ZPM_BATTERY) {
chanceCondition(0.001)
setWeight(1)
} }
}
}

View File

@ -0,0 +1,13 @@
package ru.dbotthepony.mc.otm.datagen.models
import net.minecraft.resources.ResourceLocation
import ru.dbotthepony.mc.otm.registry.MBlocks
fun addBlockModels(provider: MatteryBlockModelProvider) {
with(provider) {
resourceCubeAll(MBlocks.TRITANIUM_ORE)
resourceCubeAll(MBlocks.TRITANIUM_RAW_BLOCK)
resourceCubeAll(MBlocks.DEEPSLATE_TRITANIUM_ORE)
resourceCubeAll(MBlocks.TRITANIUM_INGOT_BLOCK)
}
}

View File

@ -1,12 +1,10 @@
package ru.dbotthepony.mc.otm.datagen.models package ru.dbotthepony.mc.otm.datagen.models
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.WaterloggedTransparentBlock import net.minecraftforge.client.model.generators.BlockModelProvider
import net.neoforged.neoforge.client.model.generators.BlockModelProvider import net.minecraftforge.data.event.GatherDataEvent
import net.neoforged.neoforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.util.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.LinkedList import java.util.LinkedList
@ -27,30 +25,6 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
return "Block Models: $modid" return "Block Models: $modid"
} }
fun cubeAll(vararg blocks: Block) {
for (block in blocks) {
exec {
cubeAll(block.registryName!!.path, modLocation("block/${block.registryName!!.path}"))
}
}
}
fun cubeAllCutout(vararg blocks: Block) {
for (block in blocks) {
exec {
cubeAll(block.registryName!!.path, modLocation("block/${block.registryName!!.path}")).renderType("cutout_mipped")
}
}
}
fun cubeAllFramed(modelName: String, textureName: String) {
exec {
withExistingParent(modelName, modLocation("block/frame_block"))
.texture("texture", textureName)
.renderType("cutout_mipped")
}
}
fun decorativeGlassAll(blocks: Collection<Block>) { fun decorativeGlassAll(blocks: Collection<Block>) {
for (block in blocks) { for (block in blocks) {
exec { exec {
@ -75,13 +49,6 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
} }
} }
fun decorativeCubeAllCutout(vararg blocks: Block) {
for (block in blocks) {
exec {
cubeAll(block.registryName!!.path, modLocation("block/decorative/${block.registryName!!.path}")).renderType("cutout_mipped")
}
}
}
fun decorativeCubeAll(subdir: String, vararg blocks: Block) { fun decorativeCubeAll(subdir: String, vararg blocks: Block) {
for (block in blocks) { for (block in blocks) {
exec { exec {
@ -112,20 +79,14 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
} }
} }
fun column(block: Block, side: String, end: String) { fun column(block: Block, end: String, side: String) {
exec { exec {
cubeColumn(block.registryName!!.path, modLocation(side), modLocation(end)) cubeColumn(block.registryName!!.path, modLocation(end), modLocation(side))
} }
} }
fun orientable(block: Block, side: String, front: String) { fun decorativeColumn(it: Block, end: String, side: String) {
exec { column(it, "block/decorative/$end", "block/decorative/$side")
orientable(block.registryName!!.path, modLocation(side), modLocation(front), modLocation(side))
}
}
fun decorativeColumn(it: Block, side: String, end: String) {
column(it, "block/decorative/$side", "block/decorative/$end")
} }
fun resourceCubeAll(vararg blocks: Block) { fun resourceCubeAll(vararg blocks: Block) {
@ -135,74 +96,4 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
} }
} }
} }
fun colored(modelName: String, suffix: String, textureKeys: Map<String, String>) {
for (color in DyeColor.entries) {
exec {
val model = withExistingParent(modelName + "_${color.name.lowercase()}$suffix", modLocation(modelName + suffix))
for ((key, value) in textureKeys) {
model.texture(key, modLocation("block/$value/${color.name.lowercase()}"))
}
}
}
}
fun colored(blocks: Map<DyeColor?, Block>, textureKeys: Collection<String>) {
val base = blocks[null]!!.registryName!!.path
colored(base, textureKeys.associateWith { base })
}
fun colored(modelName: String, textureKeys: Map<String, String>) {
return colored(modelName, "", textureKeys)
}
fun colored(modelName: String, textureKeys: Collection<String>, textureName: String) {
return colored(modelName, "", textureKeys.associateWith { textureName })
}
fun colored(modelName: String, textureKeys: Collection<String>) {
return colored(modelName, "", textureKeys.associateWith { modelName })
}
fun colored(modelName: String, suffix: String, textureKeys: Collection<String>) {
return colored(modelName, suffix, textureKeys.associateWith { modelName })
}
fun coloredMachineCombined(modelName: String, textureName: String, textureKeys: Collection<String>) {
for (state in listOf("_idle", "_error", "_working")) {
colored(modelName, state, textureKeys.associateWith { textureName })
}
}
fun coloredMachineCombined(modelName: String, textureKeys: Collection<String>) {
for (state in listOf("_idle", "_error", "_working")) {
colored(modelName, state, textureKeys.associateWith { modelName })
}
}
fun cable(modelName: String, textureName: String, thin: Boolean = false, powered: Boolean = false) {
val baseName = if (thin) "base_cable_thin" else "base_cable"
exec {
withExistingParent("block/${modelName}_core", modLocation("block/${baseName}_core"))
.texture("0", textureName)
withExistingParent("block/${modelName}_connection", modLocation("block/${baseName}_connection"))
.texture("0", textureName)
withExistingParent("item/${modelName}", modLocation("item/${baseName}"))
.texture("0", textureName)
}
if (powered && !thin) {
exec {
withExistingParent("block/${modelName}_core_powered", modLocation("block/${baseName}_core_powered"))
.texture("0", textureName)
withExistingParent("block/${modelName}_connection_powered", modLocation("block/${baseName}_connection_powered"))
.texture("0", textureName)
}
}
}
} }

View File

@ -0,0 +1,39 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import com.google.common.collect.Lists
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.MItems
import java.util.*
import java.util.function.Consumer
private fun Consumer<FinishedRecipe>.addRecyclingRecipe(inputs: Collection<ItemLike>, result: Item, name: String) {
val inputStacks = inputs.map(::ItemStack)
SimpleCookingRecipeBuilder.smelting(
Ingredient.of(inputStacks.stream()),
RecipeCategory.MISC, result, 0f, 200
).also { r -> inputs.forEach { r.unlockedBy(it) } }.save(this, modLocation("smelting/${name}"))
SimpleCookingRecipeBuilder.blasting(
Ingredient.of(inputStacks.stream()),
RecipeCategory.MISC, result, 0f, 100
).also { r -> inputs.forEach { r.unlockedBy(it) } }.save(this, modLocation("blasting/${name}"))
}
fun addBlastingRecipes(consumer: Consumer<FinishedRecipe>) {
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItems.MIRROR_COMPOUND), RecipeCategory.MISC, MItems.MIRROR, 0.1f, 100).unlockedBy(MItems.MIRROR_COMPOUND).save(consumer)
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 50).unlockedBy(MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates_blasting"))
consumer.addRecyclingRecipe(MItems.TRITANIUM_TOOLS, MItems.TRITANIUM_NUGGET, "tritanium_nugget_from_tools")
consumer.addRecyclingRecipe(MItems.SIMPLE_TRITANIUM_ARMOR, MItems.TRITANIUM_NUGGET, "tritanium_nugger_from_armor")
}

View File

@ -1,109 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.tags.ItemTags
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addComponentRecipes(consumer: RecipeOutput) {
// Обычный рецепт
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT, count = 3, category = RecipeCategory.MISC)
.row(MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES)
.row(MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING)
.unlockedBy(MItemTags.COPPER_WIRES)
.build(consumer)
// ручной рецепт
MatteryRecipe(MItems.BASIC_CONTROL_CIRCUIT, category = RecipeCategory.MISC)
.rowB(Tags.Items.DUSTS_REDSTONE)
.rowB(MItemTags.COPPER_WIRES)
.rowB(ItemTags.WOODEN_SLABS)
.unlockedBy(MItemTags.COPPER_WIRES)
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
.build(consumer, "alt")
MatteryRecipe(MItems.ADVANCED_CONTROL_CIRCUIT, count = 3, category = RecipeCategory.MISC)
.row(MItemTags.COPPER_WIRES, Tags.Items.GEMS_QUARTZ, MItemTags.COPPER_WIRES)
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
.row(MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING, MItems.CIRCUIT_PLATING)
.unlockedBy(MItemTags.GOLD_WIRES)
.build(consumer)
MatteryRecipe(MItems.MACHINE_FRAME, category = RecipeCategory.MISC)
.row(MItemTags.HARDENED_GLASS, MItemTags.BASIC_CIRCUIT, MItemTags.HARDENED_GLASS)
.row(MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS)
.rowAC(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.BASIC_CIRCUIT)
.unlockedBy(MItemTags.HARDENED_GLASS)
.unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer)
MatteryRecipe(MItems.GOLD_WIRING, count = 8, category = RecipeCategory.MISC)
.rowB(Tags.Items.INGOTS_GOLD)
.row(Tags.Items.INGOTS_GOLD, Tags.Items.RODS_WOODEN, Tags.Items.INGOTS_GOLD)
.rowB(Tags.Items.INGOTS_GOLD)
.unlockedBy(Tags.Items.INGOTS_GOLD)
.build(consumer)
MatteryRecipe(MItems.COPPER_WIRING, count = 8, category = RecipeCategory.MISC)
.rowB(Tags.Items.INGOTS_COPPER)
.row(Tags.Items.INGOTS_COPPER, Tags.Items.RODS_WOODEN, Tags.Items.INGOTS_COPPER)
.rowB(Tags.Items.INGOTS_COPPER)
.unlockedBy(Tags.Items.INGOTS_COPPER)
.build(consumer)
MatteryRecipe(MItems.ENERGY_BUS, count = 2, category = RecipeCategory.MISC)
.rowAB(Tags.Items.DUSTS_REDSTONE, MItems.ELECTRIC_PARTS)
.row(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES)
.rowBC(MItems.ELECTRIC_PARTS, Tags.Items.DUSTS_REDSTONE)
.unlockedBy(MItems.ELECTRIC_PARTS)
.unlockedBy(MItemTags.COPPER_WIRES)
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
.build(consumer)
MatteryRecipe(MItems.MATTER_IO_PORT, category = RecipeCategory.MISC)
.rowB(MItems.MATTER_CABLE)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.BASIC_CIRCUIT, MItemTags.TRITANIUM_PLATES)
.rowB(MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CABLE)
.build(consumer)
MatteryRecipe(MItems.MATTER_TRANSFORM_MATRIX, category = RecipeCategory.MISC)
.row(MItemTags.DILITHIUM_GEMS, MItems.MATTER_CABLE, MItemTags.DILITHIUM_GEMS)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES)
.rowB(MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CABLE)
.build(consumer)
MatteryRecipe(MItems.MATTER_CAPACITOR_PARTS, count = 3, category = RecipeCategory.MISC)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES, MItemTags.IRON_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.HARDENED_GLASS_PANES, MItemTags.TRITANIUM_PLATES)
.rowB(MItemTags.HARDENED_GLASS_PANES)
.unlockedBy(MItems.MATTER_CABLE)
.build(consumer)
MatteryRecipe(MItems.ELECTRIC_PARTS, count = 4, category = RecipeCategory.MISC)
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE)
.row(Tags.Items.NUGGETS_GOLD, Tags.Items.NUGGETS_IRON, Tags.Items.NUGGETS_GOLD)
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.COPPER_WIRES, Tags.Items.DUSTS_REDSTONE)
.build(consumer)
MatteryRecipe(MItems.MECHANICAL_PARTS, count = 4, category = RecipeCategory.MISC)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.INGOTS_IRON, MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.ELECTROMOTOR, category = RecipeCategory.MISC)
.rowB(MItems.ELECTRIC_PARTS)
.row(MItems.ELECTROMAGNET, MItems.MECHANICAL_PARTS, MItems.ELECTROMAGNET)
.row(MItemTags.COPPER_WIRES, MItems.MECHANICAL_PARTS, MItemTags.COPPER_WIRES)
.unlockedBy(MItems.ELECTROMAGNET)
.build(consumer)
MatteryRecipe(MItems.DISPLAY_SCREEN, 3)
.row(MItemTags.IRON_PLATES, Tags.Items.DUSTS_GLOWSTONE, Tags.Items.GLASS_PANES_COLORLESS)
.row(MItemTags.IRON_PLATES, Tags.Items.DUSTS_REDSTONE, Tags.Items.GLASS_PANES_COLORLESS)
.row(MItemTags.IRON_PLATES, Tags.Items.DUSTS_GLOWSTONE, Tags.Items.GLASS_PANES_COLORLESS)
.build(consumer)
}

View File

@ -1,61 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.util.valueproviders.ConstantFloat
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
private fun RecipeOutput.addRecyclingRecipe(inputs: Collection<ItemLike>, result: Item, name: String) {
val inputStacks = inputs.map(::ItemStack)
SimpleCookingRecipeBuilder.smelting(
Ingredient.of(inputStacks.stream()),
RecipeCategory.MISC, result, 0f, 200
).also { r -> inputs.forEach { r.unlockedBy(it) } }.save(this, modLocation("smelting/${name}"))
SimpleCookingRecipeBuilder.blasting(
Ingredient.of(inputStacks.stream()),
RecipeCategory.MISC, result, 0f, 100
).also { r -> inputs.forEach { r.unlockedBy(it) } }.save(this, modLocation("blasting/${name}"))
}
fun addBlastingRecipes(consumer: RecipeOutput) {
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItems.MIRROR_COMPOUND), RecipeCategory.MISC, MItems.MIRROR, 0.1f, 100).unlockedBy(
MItems.MIRROR_COMPOUND).save(consumer)
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(
MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_PLATES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 50).unlockedBy(
MItemTags.TRITANIUM_PLATES).save(consumer, modLocation("tritanium_ingot_from_plates_blasting"))
consumer.addRecyclingRecipe(MItems.TRITANIUM_TOOLS, MItems.TRITANIUM_NUGGET, "tritanium_nugget_from_tools")
consumer.addRecyclingRecipe(MItems.SIMPLE_TRITANIUM_ARMOR, MItems.TRITANIUM_NUGGET, "tritanium_nugger_from_armor")
}
fun addOreSmeltingRecipes(consumer: RecipeOutput) {
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("smelting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("blasting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("smelting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("blasting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("smelting/tritanium_ingot_from_dust"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("blasting/tritanium_ingot_from_dust"))
}
fun addMicrowaveRecipes(provider: MatteryRecipeProvider) {
for (drive in listOf(MItems.PATTERN_DRIVE_NORMAL, MItems.PATTERN_DRIVE_DOUBLE, MItems.PATTERN_DRIVE_TRIPLE, MItems.PATTERN_DRIVE_QUAD)) {
provider.microwave("${drive.registryName!!.path}_erase", Ingredient.of(drive), Ingredient.of(drive), workTicks = 30 * 20, experience = ConstantFloat.of(0f))
}
}

View File

@ -1,32 +1,29 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.core.component.DataComponents import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.tags.ItemTags import net.minecraft.tags.ItemTags
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.neoforged.neoforge.common.Tags import net.minecraftforge.common.Tags
import net.neoforged.neoforge.common.conditions.NotCondition
import net.neoforged.neoforge.common.conditions.TagEmptyCondition
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.mc.otm.config.CablesConfig import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.util.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.ExplosiveHammerPrimingRecipe
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
import java.util.function.Consumer
fun addCraftingTableRecipes(consumer: RecipeOutput) { fun addCraftingTableRecipes(consumer: Consumer<FinishedRecipe>) {
val machinesCategory = RecipeCategory.DECORATIONS val machinesCategory = RecipeCategory.DECORATIONS
MatteryRecipe(MRegistry.CARGO_CRATES.item, category = RecipeCategory.DECORATIONS) MatteryRecipe(MRegistry.CARGO_CRATES.item, category = RecipeCategory.DECORATIONS)
.row(MItemTags.TRITANIUM_PLATES, multiIngredient(Tags.Items.CHESTS_WOODEN, Tags.Items.BARRELS_WOODEN), MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, Tags.Items.CHESTS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.unlockedBy(Tags.Items.CHESTS) .unlockedBy(Tags.Items.CHESTS)
.build(consumer) .build(consumer)
@ -39,138 +36,50 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.save(consumer, "${crate.registryName}_alt") .save(consumer, "${crate.registryName}_alt")
} }
MItems.ENERGY_COUNTER.values.forEach { ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.TRITANIUM_INGOT_BLOCK, 1)
ShapelessRecipeBuilder(machinesCategory, it, 1) .requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS), 9)
.requires(it) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(it) .save(consumer)
.save(consumer, modLocation("${it.registryName!!.path}_reset"))
} ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 9)
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS_STORAGE))
.unlockedBy(MItemTags.TRITANIUM_INGOTS_STORAGE)
.save(consumer, modLocation("tritanium_ingot_from_storage"))
ShapelessRecipeBuilder(machinesCategory, MItems.ENERGY_COUNTER, 1)
.requires(MItems.ENERGY_COUNTER)
.unlockedBy(MItems.ENERGY_COUNTER)
.save(consumer, modLocation("energy_counter_reset"))
ShapelessRecipeBuilder(machinesCategory, MItems.HOLO_SIGN, 1) ShapelessRecipeBuilder(machinesCategory, MItems.HOLO_SIGN, 1)
.requires(MItems.HOLO_SIGN) .requires(MItems.HOLO_SIGN)
.unlockedBy(MItems.HOLO_SIGN) .unlockedBy(MItems.HOLO_SIGN)
.save(consumer, modLocation("holo_sign_reset")) .save(consumer, modLocation("holo_sign_reset"))
MatteryRecipe(MBlocks.DRIVE_VIEWER[null]!!, category = machinesCategory) MatteryRecipe(MBlocks.PLATE_PRESS, category = machinesCategory)
.rowBC(MItems.DISPLAY_SCREEN, Tags.Items.GLASS_PANES) .row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES) .row(MItemTags.TRITANIUM_INGOTS, Items.BLAST_FURNACE, MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.BASIC_CIRCUIT, MItems.MATTER_IO_PORT, MItemTags.BASIC_CIRCUIT) .row(MItemTags.PISTONS, MItemTags.TRITANIUM_INGOTS, MItemTags.PISTONS)
.unlockedBy(MItems.MATTER_IO_PORT)
.build(consumer)
MatteryRecipe(MBlocks.MATTER_BOTTLER[null]!!, category = machinesCategory)
.row(MItems.MATTER_CAPACITOR_PARTS, MItems.MATTER_IO_PORT, MItems.MATTER_CAPACITOR_PARTS)
.row(Tags.Items.GLASS_BLOCKS, MItems.MACHINE_FRAME, Tags.Items.GLASS_BLOCKS)
.rowAC(MItems.MATTER_CABLE, MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
.unlockedBy(MItems.MATTER_IO_PORT)
.build(consumer)
MatteryRecipe(MBlocks.MATTER_DECOMPOSER[null]!!, category = machinesCategory)
.row(MItems.MATTER_TRANSFORM_MATRIX, MItemTags.BASIC_CIRCUIT, MItems.MATTER_IO_PORT)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItems.MATTER_CABLE, MItems.MATTER_CAPACITOR_PARTS, MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
.unlockedBy(MItems.MATTER_IO_PORT)
.build(consumer)
MatteryRecipe(MBlocks.MATTER_PANEL[null]!!, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES, Tags.Items.GLASS_PANES)
.row(MItems.MATTER_CABLE, MItems.DISPLAY_SCREEN, Tags.Items.GLASS_PANES)
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, Tags.Items.GLASS_PANES)
.unlockedBy(Tags.Items.GLASS_BLOCKS)
.build(consumer)
MatteryRecipe(MBlocks.MATTER_REPLICATOR[null]!!, category = machinesCategory)
.row(MItems.MATTER_IO_PORT, MItemTags.ADVANCED_CIRCUIT, MItems.MATTER_TRANSFORM_MATRIX)
.row(Tags.Items.GEMS_DIAMOND, MItems.MACHINE_FRAME, Tags.Items.GEMS_DIAMOND)
.row(MItems.MATTER_CABLE, MItems.MATTER_CAPACITOR_PARTS, MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
.unlockedBy(MItems.MATTER_IO_PORT)
.unlockedBy(MItems.MATTER_TRANSFORM_MATRIX)
.build(consumer)
MatteryRecipe(MBlocks.PATTERN_STORAGE, category = machinesCategory)
.row(Tags.Items.GLASS_BLOCKS, Tags.Items.GLASS_BLOCKS, Tags.Items.GLASS_BLOCKS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItems.MATTER_CABLE, MItemTags.BASIC_CIRCUIT, MItems.MATTER_CABLE)
.unlockedBy(MItemTags.IRON_PLATES)
.build(consumer)
MatteryRecipe(MBlocks.ENERGY_COUNTER[null]!!, category = machinesCategory)
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.BASIC_CIRCUIT, MItems.DISPLAY_SCREEN, MItemTags.HARDENED_GLASS_PANES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.ENERGY_BUS)
.build(consumer)
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[null]!!, category = machinesCategory)
.rowAC(MItems.ELECTROMOTOR, MItems.ELECTROMOTOR)
.row(MItemTags.PISTONS, MItems.MACHINE_FRAME, MItemTags.PISTONS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItems.MACHINE_FRAME) .unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer) .build(consumer)
for ((color, item) in MItems.PLATE_PRESS) { MatteryRecipe(MBlocks.PLATE_PRESS, category = machinesCategory)
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[color]!!, category = machinesCategory) .rowB(MItems.MACHINE_FRAME)
.setUpgradeSource(item) .rowAC(MItemTags.PISTONS, MItemTags.PISTONS)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.rowA(item) .unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer, "plate_press_migration/${color?.name?.lowercase() ?: "default"}") .build(consumer, "advanced")
}
MatteryRecipe(MBlocks.CHEMICAL_GENERATOR[null]!!, category = machinesCategory)
.rowB(MItems.ENERGY_BUS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.FURNACES, MItemTags.TRITANIUM_INGOTS)
.rowAC(MItems.ELECTRIC_PARTS, MItems.ELECTRIC_PARTS)
.unlockedBy(MItemTags.FURNACES)
.unlockedBy(MItems.ENERGY_BUS)
.build(consumer)
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory) MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory)
.row(Tags.Items.DUSTS_GLOWSTONE, MItemTags.CARBON_PLATES, Tags.Items.DUSTS_GLOWSTONE) .rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.DILITHIUM_GEMS, MItemTags.ADVANCED_CIRCUIT, MItemTags.DILITHIUM_GEMS) .row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT)
.row(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.GEMS_DIAMOND, Tags.Items.DUSTS_GLOWSTONE) .rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
.unlockedBy(MItemTags.DILITHIUM_GEMS) .unlockedBy(MItemTags.ADVANCED_CIRCUIT)
.build(consumer)
MatteryRecipe(MItems.PATTERN_DRIVE_DOUBLE, category = machinesCategory)
.setUpgradeSource(MItems.PATTERN_DRIVE_NORMAL)
.addUpgradeOps(UpgradeRecipe.MergePatterns)
.rowB(MItemTags.DILITHIUM_GEMS)
.row(MItems.PATTERN_DRIVE_NORMAL, MItemTags.ADVANCED_CIRCUIT, MItems.PATTERN_DRIVE_NORMAL)
.rowB(MItemTags.DILITHIUM_GEMS)
.unlockedBy(MItems.PATTERN_DRIVE_NORMAL)
.build(consumer)
MatteryRecipe(MItems.PATTERN_DRIVE_TRIPLE, category = machinesCategory)
.setUpgradeSource(MItems.PATTERN_DRIVE_DOUBLE)
.addUpgradeOps(UpgradeRecipe.MergePatterns)
.row(Tags.Items.DUSTS_GLOWSTONE, MItemTags.DILITHIUM_GEMS, Tags.Items.DUSTS_GLOWSTONE)
.row(MItems.PATTERN_DRIVE_DOUBLE, MItemTags.ADVANCED_CIRCUIT, MItems.PATTERN_DRIVE_DOUBLE)
.row(Tags.Items.DUSTS_GLOWSTONE, MItemTags.DILITHIUM_GEMS, Tags.Items.DUSTS_GLOWSTONE)
.unlockedBy(MItems.PATTERN_DRIVE_DOUBLE)
.build(consumer)
MatteryRecipe(MItems.PATTERN_DRIVE_QUAD, category = machinesCategory)
.setUpgradeSource(MItems.PATTERN_DRIVE_TRIPLE)
.addUpgradeOps(UpgradeRecipe.MergePatterns)
.row(MItemTags.DILITHIUM_GEMS, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.DILITHIUM_GEMS)
.row(MItems.PATTERN_DRIVE_TRIPLE, MItemTags.ADVANCED_CIRCUIT, MItems.PATTERN_DRIVE_TRIPLE)
.row(MItemTags.DILITHIUM_GEMS, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.DILITHIUM_GEMS)
.unlockedBy(MItems.PATTERN_DRIVE_TRIPLE)
.build(consumer)
MatteryRecipe(MItems.MATTER_CABLE, count = 16, category = machinesCategory)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.row(Items.REDSTONE, MItemTags.COPPER_WIRES, Items.REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItemTags.COPPER_WIRES)
.build(consumer) .build(consumer)
// Машины // Машины
MatteryRecipe(MItems.MATTER_RECYCLER[null]!!, category = machinesCategory) MatteryRecipe(MItems.MATTER_RECYCLER, category = machinesCategory)
.row(MItems.MATTER_CAPACITOR_PARTS, Items.HOPPER, MItemTags.BASIC_CIRCUIT) .row(MItems.MATTER_CAPACITOR_PARTS, Items.HOPPER, MItemTags.BASIC_CIRCUIT)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE) .row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
@ -178,15 +87,15 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.build(consumer) .build(consumer)
// Блоки // Блоки
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK[null]!!, category = machinesCategory) MatteryRecipe(MItems.MATTER_CAPACITOR_BANK, category = machinesCategory)
.row(Tags.Items.GLASS_BLOCKS, MItemTags.IRON_PLATES, Tags.Items.GLASS_BLOCKS) .row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE) .row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CABLE) .unlockedBy(MItems.MATTER_CABLE)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BATTERY_BANK[null]!!, category = machinesCategory) MatteryRecipe(MItems.BATTERY_BANK, category = machinesCategory)
.row(Tags.Items.GLASS_BLOCKS, MItemTags.IRON_PLATES, Tags.Items.GLASS_BLOCKS) .row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS) .row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
.unlockedBy(MItems.ENERGY_BUS) .unlockedBy(MItems.ENERGY_BUS)
@ -223,14 +132,14 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.build(consumer) .build(consumer)
MatteryRecipe(MItems.BLACK_HOLE_SCANNER, category = RecipeCategory.TOOLS) MatteryRecipe(MItems.BLACK_HOLE_SCANNER, category = RecipeCategory.TOOLS)
.row(MItemTags.IRON_PLATES, MItems.DISPLAY_SCREEN, MItemTags.IRON_PLATES) .row(MItemTags.IRON_PLATES, Tags.Items.GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItemTags.GOLD_WIRES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT) .row(MItemTags.GOLD_WIRES, MItems.GRAVITATION_FIELD_SENSOR, MItemTags.ADVANCED_CIRCUIT)
.rowAC(Tags.Items.DUSTS_GLOWSTONE, MItemTags.TRITANIUM_PLATES) .rowAC(Tags.Items.DUSTS_GLOWSTONE, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR) .unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.PHANTOM_ATTRACTOR, category = machinesCategory) MatteryRecipe(MItems.PHANTOM_ATTRACTOR, category = machinesCategory)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.GLASS_BLOCKS_COLORLESS, Tags.Items.DUSTS_REDSTONE) .row(Tags.Items.DUSTS_REDSTONE, Tags.Items.GLASS_COLORLESS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, MItems.QUANTUM_TRANSCEIVER, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.QUANTUM_TRANSCEIVER, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, ItemTags.BEDS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, ItemTags.BEDS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.QUANTUM_TRANSCEIVER) .unlockedBy(MItems.QUANTUM_TRANSCEIVER)
@ -245,10 +154,10 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
MatteryRecipe(MItems.ELECTROMAGNET, category = RecipeCategory.MISC) MatteryRecipe(MItems.ELECTROMAGNET, category = RecipeCategory.MISC)
.row(MItemTags.COPPER_WIRES, Tags.Items.INGOTS_IRON, MItemTags.COPPER_WIRES) .row(MItemTags.COPPER_WIRES, Tags.Items.INGOTS_IRON, MItemTags.COPPER_WIRES)
.unlockedBy(Tags.Items.INGOTS_IRON) .unlockedBy(Tags.Items.ENDER_PEARLS)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.ENERGY_SERVO[null]!!, category = RecipeCategory.MISC) MatteryRecipe(MItems.ENERGY_SERVO, category = RecipeCategory.MISC)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.ENERGY_BUS) .unlockedBy(MItems.ENERGY_BUS)
@ -268,21 +177,6 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.REINFORCED_IRON_PLATE, category = RecipeCategory.MISC)
.rowB(MItemTags.CARBON_PLATES)
.row(MItemTags.CARBON_PLATES, MItemTags.IRON_PLATES, MItemTags.CARBON_PLATES)
.rowB(MItemTags.CARBON_PLATES)
.unlockedBy(MItemTags.IRON_PLATES)
.build(consumer)
MatteryRecipe(MItems.ARMOR_ASSEMBLY, category = RecipeCategory.MISC)
.row(MItemTags.CARBON_PLATES, MItemTags.IRON_PLATES, MItemTags.CARBON_PLATES)
.row(MItemTags.IRON_PLATES, Items.DIAMOND, MItemTags.IRON_PLATES)
.row(MItemTags.CARBON_PLATES, MItemTags.IRON_PLATES, MItemTags.CARBON_PLATES)
.unlockedBy(MItemTags.IRON_PLATES)
.unlockedBy(MItemTags.CARBON_PLATES)
.build(consumer)
MatteryRecipe(MItems.CARBON_FIBRE_BLOCK, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(MItems.CARBON_FIBRE_BLOCK, category = RecipeCategory.BUILDING_BLOCKS)
.rowAB(MItemTags.CARBON_PLATES, MItemTags.CARBON_PLATES) .rowAB(MItemTags.CARBON_PLATES, MItemTags.CARBON_PLATES)
.rowAB(MItemTags.CARBON_PLATES, MItemTags.CARBON_PLATES) .rowAB(MItemTags.CARBON_PLATES, MItemTags.CARBON_PLATES)
@ -297,40 +191,28 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
// броня // броня
MatteryRecipe(MItems.TRITANIUM_HELMET, category = RecipeCategory.COMBAT) MatteryRecipe(MItems.TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
.setUpgradeSource(Items.LEATHER_HELMET) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.addUpgradeOps(UpgradeRecipe.CopyEnchantments)
.addUpgradeOps(UpgradeRecipe.CopyComponent(DataComponents.CUSTOM_NAME))
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItems.ARMOR_ASSEMBLY, MItemTags.REINFORCED_TRITANIUM_PLATES)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_HELMET, MItemTags.REINFORCED_TRITANIUM_PLATES) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_HELMET, MItemTags.REINFORCED_TRITANIUM_PLATES)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES) .unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.TRITANIUM_PANTS, category = RecipeCategory.COMBAT) MatteryRecipe(MItems.TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
.setUpgradeSource(Items.LEATHER_LEGGINGS) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.addUpgradeOps(UpgradeRecipe.CopyEnchantments)
.addUpgradeOps(UpgradeRecipe.CopyComponent(DataComponents.CUSTOM_NAME))
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItems.ARMOR_ASSEMBLY, MItemTags.REINFORCED_TRITANIUM_PLATES)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_LEGGINGS, MItemTags.REINFORCED_TRITANIUM_PLATES) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_LEGGINGS, MItemTags.REINFORCED_TRITANIUM_PLATES)
.rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES) .rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES) .unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT) MatteryRecipe(MItems.TRITANIUM_CHESTPLATE, category = RecipeCategory.COMBAT)
.setUpgradeSource(Items.LEATHER_CHESTPLATE)
.addUpgradeOps(UpgradeRecipe.CopyEnchantments)
.addUpgradeOps(UpgradeRecipe.CopyComponent(DataComponents.CUSTOM_NAME))
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_CHESTPLATE, MItemTags.REINFORCED_TRITANIUM_PLATES) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_CHESTPLATE, MItemTags.REINFORCED_TRITANIUM_PLATES)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItems.ARMOR_ASSEMBLY, MItemTags.REINFORCED_TRITANIUM_PLATES) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES) .unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.TRITANIUM_BOOTS, category = RecipeCategory.COMBAT) MatteryRecipe(MItems.TRITANIUM_BOOTS, category = RecipeCategory.COMBAT)
.setUpgradeSource(Items.LEATHER_BOOTS)
.addUpgradeOps(UpgradeRecipe.CopyEnchantments)
.addUpgradeOps(UpgradeRecipe.CopyComponent(DataComponents.CUSTOM_NAME))
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_BOOTS, MItemTags.REINFORCED_TRITANIUM_PLATES) .row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_BOOTS, MItemTags.REINFORCED_TRITANIUM_PLATES)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItems.ARMOR_ASSEMBLY, MItemTags.REINFORCED_TRITANIUM_PLATES) .rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES) .unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer) .build(consumer)
@ -361,19 +243,58 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer) .build(consumer)
// простые батарейки
MatteryRecipe(MItems.BATTERY_CRUDE, category = RecipeCategory.MISC)
.rowB(Tags.Items.DUSTS_REDSTONE)
.rowB(Tags.Items.CROPS_POTATO)
.rowB(Tags.Items.INGOTS_IRON)
.build(consumer)
MatteryRecipe(MItems.BATTERY_BASIC, category = RecipeCategory.MISC)
.rowAC(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.rowB(MItems.ELECTRIC_PARTS)
.rowB(MItemTags.IRON_PLATES)
.build(consumer)
MatteryRecipe(MItems.BATTERY_NORMAL, category = RecipeCategory.MISC)
.rowB(MItems.ELECTRIC_PARTS)
.row(MItemTags.COPPER_WIRES, MItemTags.IRON_PLATES, MItemTags.COPPER_WIRES)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.build(consumer)
MatteryRecipe(MItems.BATTERY_DENSE, category = RecipeCategory.MISC)
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.build(consumer)
MatteryRecipe(MItems.BATTERY_CAPACITOR, category = RecipeCategory.MISC)
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.GOLD_WIRES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
.build(consumer)
// накопители материи
MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE, category = RecipeCategory.MISC)
.row(MItems.MATTER_CAPACITOR_PARTS, Tags.Items.GLASS, MItems.MATTER_CAPACITOR_PARTS)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.ENDER_PEARLS, MItemTags.TRITANIUM_PLATES)
.rowAC(Tags.Items.GEMS_DIAMOND, Tags.Items.GEMS_DIAMOND)
.build(consumer)
// станция андроида // станция андроида
MatteryRecipe(MItems.ANDROID_STATION[null]!!, category = machinesCategory) MatteryRecipe(MItems.ANDROID_STATION, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItems.QUANTUM_TRANSCEIVER, MItems.ELECTRIC_PARTS) .row(MItems.ELECTRIC_PARTS, MItemTags.ADVANCED_CIRCUIT, MItems.ELECTRIC_PARTS)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
// беспроводной зарядник андроидов // Энерго меч
MatteryRecipe(MItems.ANDROID_CHARGER[null]!!, category = machinesCategory) MatteryRecipe(MItems.ENERGY_SWORD, category = RecipeCategory.COMBAT)
.row(MItems.ELECTRIC_PARTS, MItems.QUANTUM_TRANSCEIVER, MItems.ELECTRIC_PARTS) .rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
.build(consumer) .unlockedBy(MItems.BATTERY_CAPACITOR)
.buildEnergetic(consumer)
// апгрейд на сетку крафта // апгрейд на сетку крафта
MatteryRecipe(MItems.ExopackUpgrades.CRAFTING_UPGRADE, category = RecipeCategory.TOOLS) MatteryRecipe(MItems.ExopackUpgrades.CRAFTING_UPGRADE, category = RecipeCategory.TOOLS)
@ -382,22 +303,8 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.TRITANIUM_PLATES)
.build(consumer) .build(consumer)
// апгрейд на переплавку
MatteryRecipe(MItems.ExopackUpgrades.SMELTING_UPGRADE, category = RecipeCategory.TOOLS)
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
.row(Items.FURNACE, MItems.QUANTUM_TRANSCEIVER, Items.FURNACE)
.row(MItemTags.TRITANIUM_PLATES, Items.FURNACE, MItemTags.TRITANIUM_PLATES)
.build(consumer)
// апгрейд на эндер сундук
MatteryRecipe(MItems.ExopackUpgrades.ENDER_UPGRADE, category = RecipeCategory.TOOLS)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.ELECTROMAGNET, MItemTags.ADVANCED_CIRCUIT)
.row(MItems.ELECTROMAGNET, Items.ENDER_CHEST, MItems.ELECTROMAGNET)
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTROMAGNET, MItemTags.TRITANIUM_PLATES)
.build(consumer)
// генератор коблы // генератор коблы
MatteryRecipe(MItems.COBBLESTONE_GENERATOR[null]!!, category = machinesCategory) MatteryRecipe(MItems.COBBLESTONE_GENERATOR, category = machinesCategory)
.row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.TRITANIUM_PICKAXE, MItemTags.HARDENED_GLASS_COLORLESS) .row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.TRITANIUM_PICKAXE, MItemTags.HARDENED_GLASS_COLORLESS)
.row(Items.LAVA_BUCKET, Items.HOPPER, Items.WATER_BUCKET) .row(Items.LAVA_BUCKET, Items.HOPPER, Items.WATER_BUCKET)
.rowB(Tags.Items.CHESTS) .rowB(Tags.Items.CHESTS)
@ -414,7 +321,19 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.rowB(MItemTags.REINFORCED_TRITANIUM_PLATES) .rowB(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.ESSENCE_STORAGE[null]!!, category = machinesCategory) ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_NUGGET, 9)
.requires(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1)
.requires(Ingredient.of(MItemTags.TRITANIUM_NUGGETS), 9)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
.save(consumer, modLocation("ingot_from_nuggets"))
MatteryRecipe(MItems.ESSENCE_STORAGE, category = machinesCategory)
.row(MItems.MATTER_CAPACITOR_PARTS, Items.ENDER_EYE, MItemTags.ADVANCED_CIRCUIT) .row(MItems.MATTER_CAPACITOR_PARTS, Items.ENDER_EYE, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES) .row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.GOLD_WIRES, MItemTags.HARDENED_GLASS, MItemTags.HARDENED_GLASS) .row(MItemTags.GOLD_WIRES, MItemTags.HARDENED_GLASS, MItemTags.HARDENED_GLASS)
@ -426,24 +345,16 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.rowB(Tags.Items.RODS_WOODEN) .rowB(Tags.Items.RODS_WOODEN)
.build(consumer) .build(consumer)
for ((dye, item) in MItems.MATTER_REPLICATOR) { MatteryRecipe(MItems.MATTER_RECONSTRUCTOR, category = machinesCategory)
MatteryRecipe(MItems.MATTER_RECONSTRUCTOR[dye]!!, category = machinesCategory) .setUpgradeSource(MItems.MATTER_REPLICATOR)
.setUpgradeSource(item)
.addUpgradeOps( .addUpgradeOps(
UpgradeRecipe.CopyTileComponent(MatteryBlockEntity.ENERGY_KEY, "energy"), UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.ENERGY_KEY}", "BlockEntityTag.energy"),
UpgradeRecipe.CopyTileComponent(MatteryBlockEntity.MATTER_STORAGE_KEY, "matter"), UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.MATTER_STORAGE_KEY}", "BlockEntityTag.matter"),
) )
.row(MItemTags.ADVANCED_CIRCUIT, Tags.Items.GEMS_EMERALD, MItemTags.ADVANCED_CIRCUIT) .row(MItemTags.ADVANCED_CIRCUIT, Tags.Items.GEMS_EMERALD, MItemTags.ADVANCED_CIRCUIT)
.row(MItems.ELECTRIC_PARTS, item, MItems.ELECTRIC_PARTS) .row(MItems.ELECTRIC_PARTS, MItems.MATTER_REPLICATOR, MItems.ELECTRIC_PARTS)
.row(MItems.ELECTROMAGNET, MItems.ELECTROMAGNET, MItems.ELECTROMAGNET) .row(MItems.ELECTROMAGNET, MItems.ELECTROMAGNET, MItems.ELECTROMAGNET)
.build(consumer) .build(consumer)
}
MatteryRecipe(MItems.MATTER_SCANNER[null]!!, category = machinesCategory)
.row(MItems.MIRROR, MItems.MATTER_TRANSFORM_MATRIX, MItems.MIRROR)
.row(MItemTags.HARDENED_GLASS_COLORLESS, MItems.MACHINE_FRAME, MItemTags.HARDENED_GLASS_COLORLESS)
.row(MItems.MATTER_CABLE, MItemTags.ADVANCED_CIRCUIT, MItems.MATTER_CABLE)
.build(consumer)
MatteryRecipe(MItems.FLUID_CAPSULE, category = RecipeCategory.TOOLS, count = 8) MatteryRecipe(MItems.FLUID_CAPSULE, category = RecipeCategory.TOOLS, count = 8)
.row(MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS) .row(MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS, MItemTags.TRITANIUM_NUGGETS)
@ -461,136 +372,12 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer) .build(consumer)
consumer.accept(ExplosiveHammerPrimingRecipe(modLocation("hammer_priming"), Ingredient.of(Tags.Items.NUGGETS_IRON)).finishedRecipe)
MatteryRecipe(MItems.EXPLOSIVE_HAMMER, category = RecipeCategory.COMBAT) MatteryRecipe(MItems.EXPLOSIVE_HAMMER, category = RecipeCategory.COMBAT)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.rowAB(Tags.Items.INGOTS_IRON, Tags.Items.RODS_WOODEN) .rowAB(Tags.Items.INGOTS_IRON, Tags.Items.RODS_WOODEN)
.rowB(Tags.Items.RODS_WOODEN) .rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(Items.FLINT_AND_STEEL) .unlockedBy(Items.FLINT_AND_STEEL)
.build(consumer) .build(consumer)
MatteryRecipe(MItems.POWERED_FURNACE[null]!!, category = machinesCategory)
.row(Items.FURNACE, MItems.MACHINE_FRAME, Items.FURNACE)
.unlockedBy(MItems.MACHINE_FRAME)
.build(consumer)
MatteryRecipe(MItems.POWERED_SMOKER[null]!!, category = machinesCategory)
.rowAC(Items.FURNACE, Items.FURNACE)
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
.unlockedBy(MItems.MACHINE_FRAME)
.build(consumer)
MatteryRecipe(MItems.POWERED_BLAST_FURNACE[null]!!, category = machinesCategory)
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
.row(MItems.ELECTROMAGNET, MItems.MACHINE_FRAME, MItems.ELECTROMAGNET)
.row(MItems.ELECTROMAGNET, Items.FURNACE, MItems.ELECTROMAGNET)
.unlockedBy(MItems.MACHINE_FRAME)
.build(consumer)
MatteryRecipe(MItems.INFINITE_WATER_SOURCE, category = machinesCategory)
.row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
.rowAC(Items.WATER_BUCKET, Items.WATER_BUCKET)
.row(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
.unlockedBy(Items.WATER_BUCKET)
.build(consumer)
MatteryRecipe(MItems.PAINTER, category = machinesCategory)
.row(Items.BRUSH, Items.BUCKET, Items.BUCKET)
.row(MItemTags.IRON_PLATES, Items.BUCKET, MItemTags.IRON_PLATES)
.row(MItemTags.IRON_PLATES, MItemTags.CRAFTING_TABLES, MItemTags.IRON_PLATES)
.unlockedBy(Tags.Items.DYES)
.build(consumer)
MatteryRecipe(MItems.MATTER_ENTANGLER, category = machinesCategory)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.MATTER_TRANSFORM_MATRIX, MItemTags.ADVANCED_CIRCUIT)
.row(MItems.MATTER_CAPACITOR_PARTS, MItems.MACHINE_FRAME, MItems.MATTER_IO_PORT)
.row(MItemTags.DILITHIUM_GEMS, MItems.ANTIMATTER_TRANSFORM_MATRIX, MItemTags.DILITHIUM_GEMS)
.unlockedBy(MItems.ANTIMATTER_TRANSFORM_MATRIX)
.build(consumer)
MatteryRecipe(MItems.CHEST_UPGRADER, category = RecipeCategory.TOOLS)
.rowAC(Items.REDSTONE, Items.REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, Items.ENDER_PEARL, MItemTags.TRITANIUM_PLATES)
.rowB(ItemTags.STONE_BUTTONS)
.unlockedBy(Tags.Items.CHESTS_WOODEN)
.unlockedBy(Tags.Items.BARRELS_WOODEN)
.unlockedBy(MItemTags.CARGO_CRATES)
.build(consumer)
MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.CRUDE]!!, category = machinesCategory, count = 8)
.row(Tags.Items.INGOTS_IRON, Items.REDSTONE, Tags.Items.INGOTS_IRON)
.unlockedBy(Items.REDSTONE)
.build(consumer)
MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.REGULAR]!!, category = machinesCategory, count = 16)
.row(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES)
.row(MItemTags.IRON_PLATES, Items.REDSTONE, MItemTags.IRON_PLATES)
.row(MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES, MItemTags.COPPER_WIRES)
.build(consumer)
MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.ADVANCED]!!, category = machinesCategory, count = 16)
.row(MItemTags.GOLD_WIRES, MItemTags.COPPER_WIRES, MItemTags.GOLD_WIRES)
.row(MItemTags.TRITANIUM_PLATES, Items.REDSTONE, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.GOLD_WIRES, MItemTags.COPPER_WIRES, MItemTags.GOLD_WIRES)
.build(consumer)
MatteryRecipe(MItems.ENERGY_CABLES[CablesConfig.E.SUPERCONDUCTOR]!!, category = machinesCategory)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, MItems.ELECTROMAGNET, MItemTags.REINFORCED_TRITANIUM_PLATES)
.row(Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD, Tags.Items.INGOTS_GOLD)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.BLUE_ICE, MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer)
val ironRod = ItemTags.create(ResourceLocation("c", "rods/iron"))
var condConsumer = consumer.withConditions(NotCondition(TagEmptyCondition(ironRod)))
for ((color, item) in MItems.GRILL) {
MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
.rowB(color?.tag)
.row(Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_IRON)
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
.rowB(color?.tag)
.row(ironRod, ironRod, ironRod)
.rowAC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.build(condConsumer, "grill_alt_a/${color?.name?.lowercase() ?: "default"}")
MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
.rowB(color?.tag)
.row(ironRod, ironRod, ironRod)
.rowB(MItemTags.TRITANIUM_PLATES)
.build(condConsumer, "grill_alt_b/${color?.name?.lowercase() ?: "default"}")
MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
.rowB(color?.tag)
.row(Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_IRON)
.rowB(MItemTags.TRITANIUM_PLATES)
.build(consumer, "grill_alt_c/${color?.name?.lowercase() ?: "default"}")
}
MatteryRecipe(MItems.REDSTONE_INTERACTOR, category = RecipeCategory.TOOLS)
.rowAB(Items.LEVER, Tags.Items.NUGGETS_IRON)
.rowB(Tags.Items.DUSTS_REDSTONE)
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
.build(consumer)
ShapelessRecipeBuilder.shapeless(RecipeCategory.BUILDING_BLOCKS, ItemStack(MItems.DILITHIUM_CRYSTAL_BLOCK))
.requires(MItems.DILITHIUM_CRYSTAL, 9)
.unlockedBy(MItems.DILITHIUM_CRYSTAL)
.unlockedBy(MItems.DILITHIUM_CRYSTAL_BLOCK)
.save(consumer, modLocation("dilithium_crystal/to_block"))
ShapelessRecipeBuilder.shapeless(RecipeCategory.MISC, ItemStack(MItems.DILITHIUM_CRYSTAL, 9))
.requires(MItems.DILITHIUM_CRYSTAL_BLOCK)
.unlockedBy(MItems.DILITHIUM_CRYSTAL)
.unlockedBy(MItems.DILITHIUM_CRYSTAL_BLOCK)
.save(consumer, modLocation("dilithium_crystal/from_block"))
MatteryRecipe(MItems.CONFIGURATOR, category = RecipeCategory.TOOLS)
.rowA(MItemTags.IRON_PLATES)
.row(Tags.Items.GLASS_PANES, Tags.Items.DUSTS_REDSTONE, MItems.DISPLAY_SCREEN)
.row(MItemTags.IRON_PLATES, MItemTags.BASIC_CIRCUIT, MItems.DILITHIUM_CRYSTAL)
.unlockedBy(MItems.DILITHIUM_CRYSTAL)
.unlockedBy(MItems.DISPLAY_SCREEN)
.build(consumer)
} }

View File

@ -1,21 +1,21 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.* import net.minecraft.data.recipes.*
import net.minecraft.tags.ItemTags
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import net.neoforged.neoforge.common.Tags import net.minecraftforge.common.Tags
import ru.dbotthepony.mc.otm.util.registryName import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.function.Consumer
private fun stairs(base: ItemLike, result: ItemLike, consumer: RecipeOutput) { private fun stairs(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(result, 4, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(result, 4, category = RecipeCategory.BUILDING_BLOCKS)
.rowA(base) .rowA(base)
.rowAB(base, base) .rowAB(base, base)
@ -24,14 +24,14 @@ private fun stairs(base: ItemLike, result: ItemLike, consumer: RecipeOutput) {
.build(consumer, modLocation("decorative/stairs/${base.asItem().registryName!!.path}")) .build(consumer, modLocation("decorative/stairs/${base.asItem().registryName!!.path}"))
} }
private fun slab(base: ItemLike, result: ItemLike, consumer: RecipeOutput) { private fun slab(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS)
.row(base, base, base) .row(base, base, base)
.unlockedBy(base) .unlockedBy(base)
.build(consumer, modLocation("decorative/slabs/${base.asItem().registryName!!.path}")) .build(consumer, modLocation("decorative/slabs/${base.asItem().registryName!!.path}"))
} }
private fun wall(base: ItemLike, result: ItemLike, consumer: RecipeOutput) { private fun wall(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(result, 6, category = RecipeCategory.BUILDING_BLOCKS)
.row(base, base, base) .row(base, base, base)
.row(base, base, base) .row(base, base, base)
@ -39,29 +39,29 @@ private fun wall(base: ItemLike, result: ItemLike, consumer: RecipeOutput) {
.build(consumer, modLocation("decorative/walls/${base.asItem().registryName!!.path}")) .build(consumer, modLocation("decorative/walls/${base.asItem().registryName!!.path}"))
} }
private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: RecipeOutput) { private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: Consumer<FinishedRecipe>) {
SingleItemRecipeBuilder SingleItemRecipeBuilder
.stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount) .stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount)
.unlockedBy(base) .unlockedBy(base)
.save(consumer, modLocation("stonecutting/${result.asItem().registryName!!.path}_from_${base.asItem().registryName!!.path}")) .save(consumer, modLocation("stonecutting/${result.asItem().registryName!!.path}_from_${base.asItem().registryName!!.path}"))
} }
private fun stairsWithCut(base: ItemLike, result: ItemLike, consumer: RecipeOutput) { private fun stairsWithCut(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
stairs(base, result, consumer) stairs(base, result, consumer)
cut(base, result, 1, consumer) cut(base, result, 1, consumer)
} }
private fun slabWithCut(base: ItemLike, result: ItemLike, consumer: RecipeOutput) { private fun slabWithCut(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
slab(base, result, consumer) slab(base, result, consumer)
cut(base, result, 2, consumer) cut(base, result, 2, consumer)
} }
private fun wallWithCut(base: ItemLike, result: ItemLike, consumer: RecipeOutput) { private fun wallWithCut(base: ItemLike, result: ItemLike, consumer: Consumer<FinishedRecipe>) {
wall(base, result, consumer) wall(base, result, consumer)
cut(base, result, 1, consumer) cut(base, result, 1, consumer)
} }
fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutput) { fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: Consumer<FinishedRecipe>) {
// Напольная плитка // Напольная плитка
for ((color, unrefinedItem) in MRegistry.UNREFINED_FLOOR_TILES.items) { for ((color, unrefinedItem) in MRegistry.UNREFINED_FLOOR_TILES.items) {
MatteryRecipe(unrefinedItem, 24) MatteryRecipe(unrefinedItem, 24)
@ -110,11 +110,9 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
wallWithCut(item, MRegistry.TRITANIUM_STRIPED_WALL.getItem(a, b), consumer) wallWithCut(item, MRegistry.TRITANIUM_STRIPED_WALL.getItem(a, b), consumer)
} }
for (color in DyeColor.entries) { stairsWithCut(MItems.TRITANIUM_STRIPED_BLOCK, MItems.TRITANIUM_STRIPED_STAIRS, consumer)
stairsWithCut(MItems.TRITANIUM_STRIPED_BLOCK[color]!!, MItems.TRITANIUM_STRIPED_STAIRS[color]!!, consumer) slabWithCut(MItems.TRITANIUM_STRIPED_BLOCK, MItems.TRITANIUM_STRIPED_SLAB, consumer)
slabWithCut(MItems.TRITANIUM_STRIPED_BLOCK[color]!!, MItems.TRITANIUM_STRIPED_SLAB[color]!!, consumer) wallWithCut(MItems.TRITANIUM_STRIPED_BLOCK, MItems.TRITANIUM_STRIPED_WALL, consumer)
wallWithCut(MItems.TRITANIUM_STRIPED_BLOCK[color]!!, MItems.TRITANIUM_STRIPED_WALL[color]!!, consumer)
}
for ((color, item) in MRegistry.FLOOR_TILES.items) { for ((color, item) in MRegistry.FLOOR_TILES.items) {
stairsWithCut(item, MRegistry.FLOOR_TILES_STAIRS.items[color]!!, consumer) stairsWithCut(item, MRegistry.FLOOR_TILES_STAIRS.items[color]!!, consumer)
@ -136,7 +134,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
MatteryRecipe(MItems.DANGER_STRIPE_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(MItems.DANGER_STRIPE_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowAB(Tags.Items.DYES_YELLOW, Tags.Items.INGOTS_IRON) .rowAB(Tags.Items.DYES_YELLOW, Tags.Items.INGOTS_IRON)
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONES, Tags.Items.INGOTS_IRON) .row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON)
.rowBC(Tags.Items.INGOTS_IRON, Tags.Items.DYES_BLACK) .rowBC(Tags.Items.INGOTS_IRON, Tags.Items.DYES_BLACK)
.unlockedBy(Tags.Items.INGOTS_IRON) .unlockedBy(Tags.Items.INGOTS_IRON)
.unlockedBy(Tags.Items.DYES_BLACK) .unlockedBy(Tags.Items.DYES_BLACK)
@ -144,7 +142,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
MatteryRecipe(MItems.METAL_BEAM, 24, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(MItems.METAL_BEAM, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONES, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.build(consumer, modLocation("decorative/metal_beam")) .build(consumer, modLocation("decorative/metal_beam"))
@ -177,14 +175,9 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.save(consumer, modLocation("decorative/vent/from_alt/${color?.name?.lowercase() ?: "default"}")) .save(consumer, modLocation("decorative/vent/from_alt/${color?.name?.lowercase() ?: "default"}"))
} }
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.METAL_BEAM_CENTER, 1).requires(MItems.METAL_BEAM)
.unlockedBy(MItems.METAL_BEAM)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.METAL_BEAM, 1).requires(MItems.METAL_BEAM_CENTER)
.unlockedBy(MItems.METAL_BEAM_CENTER)
MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(MRegistry.DECORATIVE_CRATE.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONES, Tags.Items.INGOTS_IRON) .row(Tags.Items.INGOTS_IRON, Tags.Items.COBBLESTONE, Tags.Items.INGOTS_IRON)
.rowB(Tags.Items.INGOTS_IRON) .rowB(Tags.Items.INGOTS_IRON)
.unlockedBy(Tags.Items.INGOTS_IRON) .unlockedBy(Tags.Items.INGOTS_IRON)
.build(consumer, modLocation("decorative/crate/rusty")) .build(consumer, modLocation("decorative/crate/rusty"))
@ -240,7 +233,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
DyeColor.BLACK to Items.BLACK_STAINED_GLASS, DyeColor.BLACK to Items.BLACK_STAINED_GLASS,
) )
for (color in DyeColor.entries) { for (color in DyeColor.values()) {
val item = MRegistry.INDUSTRIAL_GLASS.items[color]!! val item = MRegistry.INDUSTRIAL_GLASS.items[color]!!
val paneItem = MRegistry.INDUSTRIAL_GLASS_PANE.items[color]!! val paneItem = MRegistry.INDUSTRIAL_GLASS_PANE.items[color]!!
val mappedVanilla = mappingUpgradeVanilla[color]!! val mappedVanilla = mappingUpgradeVanilla[color]!!
@ -273,42 +266,6 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.save(consumer, modLocation("decorative/industrial_glass_pane/recolor/${color.name.lowercase()}")) .save(consumer, modLocation("decorative/industrial_glass_pane/recolor/${color.name.lowercase()}"))
} }
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.REDSTONE_LAMP_INVERTED, 1)
.requires(Items.REDSTONE_LAMP)
.unlockedBy(Items.REDSTONE_LAMP)
.save(consumer, modLocation("decorative/inverted_redstone_lamp"))
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, Items.REDSTONE_LAMP, 1)
.requires(MItems.REDSTONE_LAMP_INVERTED)
.unlockedBy(MItems.REDSTONE_LAMP_INVERTED)
.save(consumer, modLocation("decorative/inverted_redstone_lamp2"))
MatteryRecipe(MItems.REINFORCED_REDSTONE_LAMP, category = RecipeCategory.REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, Items.REDSTONE_LAMP, MItemTags.TRITANIUM_PLATES)
.build(consumer, modLocation("decorative/reinforced_redstone_lamp"))
MatteryRecipe(MItems.REINFORCED_REDSTONE_LAMP_INVERTED, category = RecipeCategory.REDSTONE)
.row(MItemTags.TRITANIUM_PLATES, MItems.REDSTONE_LAMP_INVERTED, MItemTags.TRITANIUM_PLATES)
.build(consumer, modLocation("decorative/reinforced_redstone_lamp_inverted"))
MatteryRecipe(MItems.LABORATORY_LAMP, category = RecipeCategory.REDSTONE)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItems.MIRROR, Items.REDSTONE_LAMP, MItems.MIRROR)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES)
.build(consumer, modLocation("decorative/lab_lamp"))
MatteryRecipe(MItems.LABORATORY_LAMP, category = RecipeCategory.REDSTONE)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItems.MIRROR, MItems.REINFORCED_REDSTONE_LAMP, MItems.MIRROR)
.rowB(Tags.Items.DUSTS_REDSTONE)
.build(consumer, modLocation("decorative/lab_lamp_alt"))
MatteryRecipe(MItems.LABORATORY_LAMP_INVERTED, category = RecipeCategory.REDSTONE)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItems.MIRROR, MItems.REINFORCED_REDSTONE_LAMP_INVERTED, MItems.MIRROR)
.rowB(Tags.Items.DUSTS_REDSTONE)
.build(consumer, modLocation("decorative/lab_lamp_inv_alt"))
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.LABORATORY_LAMP, 1) ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.LABORATORY_LAMP, 1)
.requires(MItems.LABORATORY_LAMP_INVERTED) .requires(MItems.LABORATORY_LAMP_INVERTED)
.unlockedBy(MItems.LABORATORY_LAMP_INVERTED) .unlockedBy(MItems.LABORATORY_LAMP_INVERTED)
@ -319,29 +276,17 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItems.LABORATORY_LAMP) .unlockedBy(MItems.LABORATORY_LAMP)
.save(consumer, MItems.LABORATORY_LAMP_INVERTED.registryName!!.toString() + "_inv") .save(consumer, MItems.LABORATORY_LAMP_INVERTED.registryName!!.toString() + "_inv")
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.REINFORCED_REDSTONE_LAMP, 1) MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
.requires(MItems.REINFORCED_REDSTONE_LAMP_INVERTED)
.unlockedBy(MItems.REINFORCED_REDSTONE_LAMP_INVERTED)
.save(consumer, MItems.REINFORCED_REDSTONE_LAMP_INVERTED.registryName!!.toString() + "_inv")
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.REINFORCED_REDSTONE_LAMP_INVERTED, 1)
.requires(MItems.REINFORCED_REDSTONE_LAMP)
.unlockedBy(MItems.REINFORCED_REDSTONE_LAMP)
.save(consumer, MItems.REINFORCED_REDSTONE_LAMP.registryName!!.toString() + "_inv")
for (color in DyeColor.entries) {
MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK[color]!!, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONES, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowAB(color.tag, MItemTags.TRITANIUM_INGOTS) .rowAB(Tags.Items.DYES_YELLOW, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(color.tag) .unlockedBy(Tags.Items.DYES_YELLOW)
.build(consumer, modLocation("decorative/blocks/striped_default_${color.name.lowercase()}")) .build(consumer, modLocation("decorative/blocks/striped_default"))
}
MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24, category = RecipeCategory.BUILDING_BLOCKS) MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONES, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer, modLocation("decorative/blocks/default")) .build(consumer, modLocation("decorative/blocks/default"))
@ -353,7 +298,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer, modLocation("decorative/doors/default")) .build(consumer, modLocation("decorative/doors/default"))
for (color in DyeColor.entries) { for (color in DyeColor.values()) {
ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_DOOR[color]!!, 1) ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_DOOR[color]!!, 1)
.requires(Ingredient.of(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) })) .requires(Ingredient.of(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
.requires(color.tag) .requires(color.tag)
@ -367,7 +312,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItemTags.TRITANIUM_INGOTS) .unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer, modLocation("decorative/trapdoors/default")) .build(consumer, modLocation("decorative/trapdoors/default"))
for (color in DyeColor.entries) { for (color in DyeColor.values()) {
ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_TRAPDOOR[color]!!, 1) ShapelessRecipeBuilder.shapeless(RecipeCategory.REDSTONE, MItems.TRITANIUM_TRAPDOOR[color]!!, 1)
.requires(Ingredient.of(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) })) .requires(Ingredient.of(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
.requires(color.tag) .requires(color.tag)
@ -380,7 +325,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItemTags.TRITANIUM_PLATES) .unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer, modLocation("pressure_plates/default")) .build(consumer, modLocation("pressure_plates/default"))
for (dye in DyeColor.entries) { for (dye in DyeColor.values()) {
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MRegistry.TRITANIUM_PRESSURE_PLATE.getItem(dye), 1) ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MRegistry.TRITANIUM_PRESSURE_PLATE.getItem(dye), 1)
.requires(Ingredient.of(MRegistry.TRITANIUM_PRESSURE_PLATE.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) })) .requires(Ingredient.of(MRegistry.TRITANIUM_PRESSURE_PLATE.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) }))
.requires(dye.tag) .requires(dye.tag)
@ -404,13 +349,12 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(Items.IRON_BARS) .unlockedBy(Items.IRON_BARS)
.build(consumer, modLocation("decorative/metal_mesh")) .build(consumer, modLocation("decorative/metal_mesh"))
MatteryRecipe(MItems.METAL_RAILING, count = 16, category = RecipeCategory.BUILDING_BLOCKS) // лампа
.row(MItems.METAL_MESH, MItems.METAL_MESH, MItems.METAL_MESH) MatteryRecipe(MItems.LABORATORY_LAMP, category = RecipeCategory.REDSTONE)
.row(MItems.METAL_MESH, MItems.METAL_MESH, MItems.METAL_MESH) .row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.unlockedBy(Items.IRON_BARS) .row(MItems.MIRROR, Items.GLOWSTONE, MItems.MIRROR)
.unlockedBy(Tags.Items.NUGGETS_IRON) .row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.METAL_MESH) .build(consumer, modLocation("decorative/lamp"))
.build(consumer, modLocation("decorative/metal_railing"))
// Голо табличка // Голо табличка
MatteryRecipe(MItems.HOLO_SIGN, category = RecipeCategory.DECORATIONS) MatteryRecipe(MItems.HOLO_SIGN, category = RecipeCategory.DECORATIONS)
@ -424,29 +368,9 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.build(consumer, modLocation("decorative/tritanium_bars")) .build(consumer, modLocation("decorative/tritanium_bars"))
MatteryRecipe(MItems.TRITANIUM_ANVIL[null]!![0], category = RecipeCategory.DECORATIONS) MatteryRecipe(MItems.TRITANIUM_ANVIL[0], category = RecipeCategory.DECORATIONS)
.row(MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE) .row(MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE, MItemTags.TRITANIUM_INGOTS_STORAGE)
.rowB(MItemTags.TRITANIUM_INGOTS) .rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS) .row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.build(consumer) .build(consumer)
for ((color, item) in MRegistry.COMPUTER_TERMINAL.allItems) {
val builder = MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
if (color != null) {
builder.rowB(color.tag)
}
builder.row(MItemTags.TRITANIUM_PLATES, MItems.DISPLAY_SCREEN, MItemTags.HARDENED_GLASS_PANES_COLORLESS)
builder.rowB(MItemTags.BASIC_CIRCUIT)
builder.build(consumer)
}
for ((color, item) in MRegistry.STAR_CHAIR.allItems) {
MatteryRecipe(item, category = RecipeCategory.DECORATIONS)
.rowB(color?.tag)
.row(MItemTags.TRITANIUM_PLATES, ItemTags.WOOL, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES)
.build(consumer)
}
} }

View File

@ -1,120 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.world.item.Item
import net.minecraft.world.item.Items
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
private fun makeNormalRecipe(element: Item, result: Item): MatteryRecipe {
return MatteryRecipe(result, 1)
.row(MItemTags.COPPER_WIRES, Items.REDSTONE, MItemTags.COPPER_WIRES)
.row(MItemTags.CARBON_PLATES, element, MItemTags.CARBON_PLATES)
.rowB(MItems.ELECTRIC_PARTS)
.unlockedBy(MItemTags.IRON_PLATES)
.unlockedBy(MItems.ELECTRIC_PARTS)
.unlockedBy(element)
}
private fun makeAdvancedRecipe(element: Item, result: Item): MatteryRecipe {
return MatteryRecipe(result, 1)
.row(MItemTags.GOLD_WIRES, MItemTags.DILITHIUM_GEMS, MItemTags.GOLD_WIRES)
.row(MItemTags.TRITANIUM_PLATES, element, MItemTags.TRITANIUM_PLATES)
.row(MItems.ELECTRIC_PARTS, MItemTags.DILITHIUM_GEMS, MItems.ELECTRIC_PARTS)
.unlockedBy(MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.ELECTRIC_PARTS)
.unlockedBy(element)
}
fun addMachineUpgradeRecipes(consumer: RecipeOutput) {
MatteryRecipe(MItems.MachineUpgrades.Basic.BLANK)
.rowB(Items.REDSTONE)
.rowAC(MItemTags.IRON_PLATES, MItemTags.IRON_PLATES)
.rowB(MItems.ELECTRIC_PARTS)
.unlockedBy(MItemTags.IRON_PLATES)
.unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer)
makeNormalRecipe(MItems.MachineUpgrades.Basic.BLANK, MItems.MachineUpgrades.Normal.BLANK)
.build(consumer)
makeAdvancedRecipe(MItems.MachineUpgrades.Normal.BLANK, MItems.MachineUpgrades.Advanced.BLANK)
.build(consumer)
makeNormalRecipe(MItems.MachineUpgrades.Basic.SPEED, MItems.MachineUpgrades.Normal.SPEED)
.build(consumer, "upgrade")
makeNormalRecipe(MItems.MachineUpgrades.Basic.ENERGY_CONSUMPTION, MItems.MachineUpgrades.Normal.ENERGY_CONSUMPTION)
.build(consumer, "upgrade")
makeNormalRecipe(MItems.MachineUpgrades.Basic.FAILSAFE, MItems.MachineUpgrades.Normal.FAILSAFE)
.build(consumer, "upgrade")
makeNormalRecipe(MItems.MachineUpgrades.Basic.ENERGY_STORAGE, MItems.MachineUpgrades.Normal.ENERGY_STORAGE)
.build(consumer, "upgrade")
makeNormalRecipe(MItems.MachineUpgrades.Basic.MATTER_STORAGE, MItems.MachineUpgrades.Normal.MATTER_STORAGE)
.build(consumer, "upgrade")
makeNormalRecipe(MItems.MachineUpgrades.Basic.PROCESSING_ITEMS, MItems.MachineUpgrades.Normal.PROCESSING_ITEMS)
.build(consumer, "upgrade")
makeAdvancedRecipe(MItems.MachineUpgrades.Normal.SPEED, MItems.MachineUpgrades.Advanced.SPEED)
.build(consumer, "upgrade")
makeAdvancedRecipe(MItems.MachineUpgrades.Normal.ENERGY_CONSUMPTION, MItems.MachineUpgrades.Advanced.ENERGY_CONSUMPTION)
.build(consumer, "upgrade")
makeAdvancedRecipe(MItems.MachineUpgrades.Normal.FAILSAFE, MItems.MachineUpgrades.Advanced.FAILSAFE)
.build(consumer, "upgrade")
makeAdvancedRecipe(MItems.MachineUpgrades.Normal.ENERGY_STORAGE, MItems.MachineUpgrades.Advanced.ENERGY_STORAGE)
.build(consumer, "upgrade")
makeAdvancedRecipe(MItems.MachineUpgrades.Normal.MATTER_STORAGE, MItems.MachineUpgrades.Advanced.MATTER_STORAGE)
.build(consumer, "upgrade")
makeAdvancedRecipe(MItems.MachineUpgrades.Normal.PROCESSING_ITEMS, MItems.MachineUpgrades.Advanced.PROCESSING_ITEMS)
.build(consumer, "upgrade")
for (tier in MItems.MachineUpgrades.CRAFTABLE_TIERS) {
MatteryRecipe(tier.SPEED, 1)
.rowB(Items.REDSTONE)
.row(Items.SUGAR, MItemTags.COPPER_WIRES, Items.SUGAR)
.row(MItems.MECHANICAL_PARTS, tier.BLANK, MItems.MECHANICAL_PARTS)
.unlockedBy(tier.BLANK)
.unlockedBy(MItemTags.COPPER_WIRES)
.build(consumer)
MatteryRecipe(tier.ENERGY_CONSUMPTION, 1)
.rowB(Items.REDSTONE)
.row(MItemTags.COPPER_WIRES, MItemTags.GOLD_WIRES, MItemTags.COPPER_WIRES)
.row(MItems.ELECTRIC_PARTS, tier.BLANK, MItems.ELECTRIC_PARTS)
.unlockedBy(tier.BLANK)
.unlockedBy(MItemTags.GOLD_WIRES)
.build(consumer)
MatteryRecipe(tier.FAILSAFE, 1)
.rowB(MItems.ELECTRIC_PARTS)
.row(MItemTags.COPPER_WIRES, MItems.QUANTUM_TRANSCEIVER, MItemTags.COPPER_WIRES)
.row(Tags.Items.DUSTS_GLOWSTONE, tier.BLANK, Tags.Items.DUSTS_GLOWSTONE)
.unlockedBy(tier.BLANK)
.unlockedBy(MItems.QUANTUM_TRANSCEIVER)
.build(consumer)
MatteryRecipe(tier.ENERGY_STORAGE, 1)
.rowB(Items.REDSTONE)
.row(Items.REDSTONE, MItems.ENERGY_BUS, Items.REDSTONE)
.row(MItems.ELECTRIC_PARTS, tier.BLANK, MItems.ELECTRIC_PARTS)
.unlockedBy(tier.BLANK)
.unlockedBy(MItems.ENERGY_BUS)
.build(consumer)
MatteryRecipe(tier.MATTER_STORAGE, 1)
.rowB(MItemTags.HARDENED_GLASS)
.row(MItemTags.HARDENED_GLASS, MItems.MATTER_CAPACITOR_PARTS, MItemTags.HARDENED_GLASS)
.row(MItems.MATTER_CAPACITOR_PARTS, tier.BLANK, MItems.MATTER_CAPACITOR_PARTS)
.unlockedBy(tier.BLANK)
.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
.build(consumer)
MatteryRecipe(tier.PROCESSING_ITEMS, 1)
.rowB(MItems.MECHANICAL_PARTS)
.row(MItems.ELECTROMAGNET, MItemTags.TRITANIUM_PLATES, MItems.ELECTROMAGNET)
.row(Tags.Items.ENDER_PEARLS, tier.BLANK, Tags.Items.ENDER_PEARLS)
.unlockedBy(tier.BLANK)
.unlockedBy(MItems.ELECTROMAGNET)
.build(consumer)
}
}

View File

@ -1,85 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.core.NonNullList
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.item.crafting.ShapedRecipePattern
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.util.math.Decimal
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.MatterEntanglerRecipe
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
import java.util.*
private fun pattern(
c00: Ingredient, c10: Ingredient, c20: Ingredient,
c01: Ingredient, c11: Ingredient, c21: Ingredient,
c02: Ingredient, c12: Ingredient, c22: Ingredient,
): ShapedRecipePattern {
val patternMap = linkedMapOf(
'A' to c00, 'B' to c10, 'C' to c20,
'D' to c01, 'E' to c11, 'F' to c21,
'G' to c02, 'K' to c12, 'M' to c22,
)
val pattern = listOf(
"ABC",
"DEF",
"GKM",
)
return ShapedRecipePattern(
3, 3,
NonNullList.copyOf(patternMap.values),
Optional.of(ShapedRecipePattern.Data(patternMap, pattern))
)
}
fun addMatterEntanglerRecipes(consumer: RecipeOutput) {
consumer.accept(
modLocation("quantum_capacitor"),
MatterEntanglerRecipe(
pattern(
Ingredient.of(MItems.ELECTRIC_PARTS), Ingredient.of(MItemTags.GOLD_WIRES), Ingredient.of(MItems.ELECTRIC_PARTS),
Ingredient.of(MItems.BATTERY_CAPACITOR), Ingredient.of(MItems.QUANTUM_TRANSCEIVER), Ingredient.of(MItems.BATTERY_CAPACITOR),
Ingredient.of(MItemTags.TRITANIUM_PLATES), Ingredient.of(MItemTags.TRITANIUM_PLATES), Ingredient.of(MItemTags.TRITANIUM_PLATES),
),
Decimal(40),
400.0,
ItemStack(MItems.QUANTUM_CAPACITOR, 2),
experience = 15f
).energetic()
)
consumer.accept(
modLocation("quantum_battery"),
MatterEntanglerRecipe(
pattern(
Ingredient.of(Tags.Items.STORAGE_BLOCKS_REDSTONE), Ingredient.of(MItemTags.GOLD_WIRES), Ingredient.of(Tags.Items.STORAGE_BLOCKS_REDSTONE),
Ingredient.of(MItems.BATTERY_DENSE), Ingredient.of(MItems.QUANTUM_TRANSCEIVER), Ingredient.of(MItems.BATTERY_DENSE),
Ingredient.of(MItemTags.TRITANIUM_PLATES), Ingredient.of(MItemTags.TRITANIUM_PLATES), Ingredient.of(MItemTags.TRITANIUM_PLATES),
),
Decimal(120),
600.0,
ItemStack(MItems.QUANTUM_BATTERY, 2),
experience = 20f
).energetic()
)
consumer.accept(
modLocation("antimatter_transform_matrix"),
MatterEntanglerRecipe(
ingredients = pattern(
Ingredient.of(Tags.Items.ENDER_PEARLS), Ingredient.of(MItemTags.DILITHIUM_GEMS), Ingredient.of(Tags.Items.ENDER_PEARLS),
Ingredient.of(Tags.Items.DUSTS_REDSTONE), Ingredient.of(MItems.MATTER_TRANSFORM_MATRIX), Ingredient.of(Tags.Items.DUSTS_REDSTONE),
Ingredient.of(Tags.Items.DUSTS_GLOWSTONE), Ingredient.of(MItemTags.DILITHIUM_GEMS), Ingredient.of(Tags.Items.DUSTS_GLOWSTONE),
),
matter = Decimal(600),
ticks = 2000.0,
result = ItemStack(MItems.ANTIMATTER_TRANSFORM_MATRIX, 1),
experience = 20f
).energetic()
)
}

View File

@ -1,25 +1,25 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.advancements.Advancement import com.google.gson.JsonObject
import net.minecraft.advancements.AdvancementHolder import net.minecraft.advancements.CriterionTriggerInstance
import net.minecraft.advancements.Criterion import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapedRecipeBuilder import net.minecraft.data.recipes.ShapedRecipeBuilder
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.item.crafting.Recipe
import net.minecraft.world.item.crafting.RecipeSerializer import net.minecraft.world.item.crafting.RecipeSerializer
import net.minecraft.world.item.crafting.ShapedRecipe
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import net.neoforged.neoforge.common.conditions.ICondition
import ru.dbotthepony.mc.otm.OverdriveThatMatters import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.util.registryName import ru.dbotthepony.mc.otm.core.collect.JsonArrayCollector
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.core.set
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.EnergyContainerRecipe
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
import java.util.function.Consumer
private interface RecipeCell { private interface RecipeCell {
val value: Ingredient val value: Ingredient
@ -62,11 +62,11 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
private val rows = arrayOfNulls<RecipeRow>(3) private val rows = arrayOfNulls<RecipeRow>(3)
private var index = 0 private var index = 0
private val unlockedBy = ArrayList<Pair<String, Criterion<*>>>().also { private val unlockedBy = ArrayList<Pair<String, CriterionTriggerInstance>>().also {
it.add("has_result" to has(result)) it.add("has_result" to has(result))
} }
fun unlockedBy(name: String, trigger: Criterion<*>): MatteryRecipe { fun unlockedBy(name: String, trigger: CriterionTriggerInstance): MatteryRecipe {
unlockedBy.add(name to trigger) unlockedBy.add(name to trigger)
return this return this
} }
@ -76,11 +76,6 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
return unlockedBy("has_${location.namespace}_${location.path}", has(item)) return unlockedBy("has_${location.namespace}_${location.path}", has(item))
} }
fun unlockedBy(item: Collection<ItemLike>): MatteryRecipe {
item.forEach { unlockedBy(it) }
return this
}
fun unlockedBy(item: TagKey<Item>): MatteryRecipe { fun unlockedBy(item: TagKey<Item>): MatteryRecipe {
return unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item)) return unlockedBy("has_${item.location.namespace}_${item.location.path}", has(item))
} }
@ -168,35 +163,56 @@ class MatteryRecipe(val result: ItemLike, val count: Int = 1, val category: Reci
return this return this
} }
private fun filter(): (ShapedRecipe) -> ShapedRecipe { private fun filter(consumer: Consumer<FinishedRecipe>): Consumer<FinishedRecipe> {
if (upgradeSource != null) { if (upgradeSource != null) {
check(copyPaths.isNotEmpty()) { "Defined upgrade recipe without nbt migration operations" } check(copyPaths.isNotEmpty()) { "Defined upgrade recipe without nbt migration operations" }
return { return Consumer {
UpgradeRecipe(it, copyPaths.map { upgradeSource!! to it }) consumer.accept(object : FinishedRecipe by it {
override fun serializeRecipeData(pJson: JsonObject) {
it.serializeRecipeData(pJson)
pJson["copyPaths"] = copyPaths.stream().map { it.serialize() }.collect(JsonArrayCollector)
pJson["source"] = upgradeSource!!.toString()
}
override fun getType(): RecipeSerializer<*> {
return UpgradeRecipe.Companion
}
})
} }
} }
return { it } return consumer
} }
fun build(consumer: RecipeOutput, name: String? = null) { fun build(consumer: Consumer<FinishedRecipe>, name: String? = null) {
val builder = buildRegular() val builder = buildRegular()
if (name != null) { if (name != null) {
builder.save(consumer.map(filter()), modLocation( builder.save(filter(consumer), modLocation(
if (result.asItem().registryName!!.namespace == OverdriveThatMatters.MOD_ID) if (result.asItem().registryName!!.namespace == OverdriveThatMatters.MOD_ID)
"${result.asItem().registryName!!.path}_$name" "${result.asItem().registryName!!.path}_$name"
else else
"${result.asItem().registryName!!.namespace}_${result.asItem().registryName!!.path}_$name" "${result.asItem().registryName!!.namespace}_${result.asItem().registryName!!.path}_$name"
)) ))
} else { } else {
builder.save(consumer.map(filter())) builder.save(filter(consumer))
} }
} }
fun build(consumer: RecipeOutput, name: ResourceLocation) { fun build(consumer: Consumer<FinishedRecipe>, name: ResourceLocation) {
buildRegular().save(consumer.map(filter()), name) buildRegular().save(filter(consumer), name)
}
fun buildEnergetic(consumer: Consumer<FinishedRecipe>, name: String? = null) {
build({
consumer.accept(object : FinishedRecipe by it {
override fun getType(): RecipeSerializer<*> {
return EnergyContainerRecipe.Companion
}
})
}, name)
} }
fun row(): MatteryRecipe { fun row(): MatteryRecipe {

View File

@ -1,71 +1,50 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import com.google.common.collect.ImmutableList import net.minecraft.advancements.critereon.ContextAwarePredicate
import net.minecraft.advancements.Advancement import net.minecraft.advancements.critereon.EntityPredicate
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.CriteriaTriggers
import net.minecraft.advancements.Criterion
import net.minecraft.advancements.critereon.InventoryChangeTrigger import net.minecraft.advancements.critereon.InventoryChangeTrigger
import net.minecraft.advancements.critereon.ItemPredicate import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.advancements.critereon.MinMaxBounds import net.minecraft.advancements.critereon.MinMaxBounds
import net.minecraft.data.DataGenerator
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeBuilder import net.minecraft.data.recipes.RecipeBuilder
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.RecipeProvider import net.minecraft.data.recipes.RecipeProvider
import net.minecraft.resources.ResourceLocation import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.ItemTags
import net.minecraft.tags.TagKey import net.minecraft.tags.TagKey
import net.minecraft.util.valueproviders.ConstantFloat import net.minecraft.util.valueproviders.ConstantFloat
import net.minecraft.util.valueproviders.FloatProvider import net.minecraft.util.valueproviders.FloatProvider
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.item.crafting.Recipe
import net.minecraft.world.item.crafting.ShapedRecipePattern
import net.minecraft.world.level.ItemLike import net.minecraft.world.level.ItemLike
import net.neoforged.neoforge.common.conditions.ICondition import ru.dbotthepony.mc.otm.core.registryName
import net.neoforged.neoforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.MicrowaveRecipe
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
import java.util.* import java.util.LinkedList
import java.util.function.Consumer
import java.util.stream.Stream import java.util.stream.Stream
private typealias RecipeBuilderCallback = (MatteryRecipeProvider, consumer: RecipeOutput) -> Unit private typealias RecipeBuilderCallback = (MatteryRecipeProvider, consumer: Consumer<FinishedRecipe>) -> Unit
fun has(p_176521_: MinMaxBounds.Ints, p_176522_: ItemLike): Criterion<InventoryChangeTrigger.TriggerInstance> { fun has(p_176521_: MinMaxBounds.Ints, p_176522_: ItemLike): InventoryChangeTrigger.TriggerInstance {
return inventoryTrigger(ItemPredicate.Builder.item().of(p_176522_).withCount(p_176521_).build()) return inventoryTrigger(ItemPredicate.Builder.item().of(p_176522_).withCount(p_176521_).build())
} }
fun has(p_125978_: ItemLike): Criterion<InventoryChangeTrigger.TriggerInstance> { fun has(p_125978_: ItemLike): InventoryChangeTrigger.TriggerInstance {
return inventoryTrigger(ItemPredicate.Builder.item().of(p_125978_).build()) return inventoryTrigger(ItemPredicate.Builder.item().of(p_125978_).build())
} }
fun has(p_125976_: TagKey<Item>): Criterion<InventoryChangeTrigger.TriggerInstance> { fun has(p_125976_: TagKey<Item>): InventoryChangeTrigger.TriggerInstance {
return inventoryTrigger(ItemPredicate.Builder.item().of(p_125976_).build()) return inventoryTrigger(ItemPredicate.Builder.item().of(p_125976_).build())
} }
fun inventoryTrigger(vararg p_126012_: ItemPredicate): Criterion<InventoryChangeTrigger.TriggerInstance> { fun inventoryTrigger(vararg p_126012_: ItemPredicate): InventoryChangeTrigger.TriggerInstance {
return CriteriaTriggers.INVENTORY_CHANGED.createCriterion(InventoryChangeTrigger.TriggerInstance( return InventoryChangeTrigger.TriggerInstance(
Optional.empty(), ContextAwarePredicate.ANY,
InventoryChangeTrigger.TriggerInstance.Slots.ANY, MinMaxBounds.Ints.ANY,
ImmutableList.copyOf(p_126012_) MinMaxBounds.Ints.ANY,
)) MinMaxBounds.Ints.ANY,
} p_126012_
)
fun multiIngredient(vararg items: Any) : Ingredient {
val values = arrayListOf<Ingredient.Value>()
for (item in items) {
if (item is ItemStack) {
values.add(Ingredient.ItemValue(item))
} else if (item is TagKey<*>) {
values.add(Ingredient.TagValue(item as TagKey<Item>))
}
}
return Ingredient.fromValues(values.stream())
} }
fun <T : RecipeBuilder> T.unlockedBy(item: ItemLike): T { fun <T : RecipeBuilder> T.unlockedBy(item: ItemLike): T {
@ -87,28 +66,7 @@ fun <T : RecipeBuilder> T.unlockedBy(item: TagKey<Item>): T {
return this return this
} }
fun <IN : Recipe<*>> RecipeOutput.map(mapper: (IN) -> Recipe<*>): RecipeOutput { class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn.packOutput) {
return object : RecipeOutput {
override fun advancement(): Advancement.Builder {
return this@map.advancement()
}
override fun accept(
id: ResourceLocation,
recipe: Recipe<*>,
advancement: AdvancementHolder?,
vararg conditions: ICondition?
) {
this@map.accept(id, mapper(recipe as IN), advancement, *conditions)
}
}
}
fun RecipeOutput.accept(id: ResourceLocation, recipe: Recipe<*>) {
accept(id, recipe, null)
}
class MatteryRecipeProvider(generatorIn: GatherDataEvent) : RecipeProvider(generatorIn.generator.packOutput, generatorIn.lookupProvider) {
private val callbacks = LinkedList<RecipeBuilderCallback>() private val callbacks = LinkedList<RecipeBuilderCallback>()
fun exec(callback: RecipeBuilderCallback): MatteryRecipeProvider { fun exec(callback: RecipeBuilderCallback): MatteryRecipeProvider {
@ -116,7 +74,7 @@ class MatteryRecipeProvider(generatorIn: GatherDataEvent) : RecipeProvider(gener
return this return this
} }
override fun buildRecipes(callback: RecipeOutput) { override fun buildRecipes(callback: Consumer<FinishedRecipe>) {
for (lambda in callbacks) { for (lambda in callbacks) {
lambda(this, callback) lambda(this, callback)
} }
@ -124,9 +82,10 @@ class MatteryRecipeProvider(generatorIn: GatherDataEvent) : RecipeProvider(gener
fun plate(id: String, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) { fun plate(id: String, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
exec { _, consumer -> exec { _, consumer ->
consumer.accept(modLocation("plates/$id"), PlatePressRecipe( consumer.accept(PlatePressShallowFinishedRecipe(
Ingredient.of(ItemTags.create(ResourceLocation("c", "ingots/$id"))), modLocation("plates/$id"),
Ingredient.of(ItemTags.create(ResourceLocation("c", "plates/$id"))), ResourceLocation("forge", "ingots/$id"),
ResourceLocation("forge", "plates/$id"),
count, count,
workTicks, workTicks,
experience = experience experience = experience
@ -136,13 +95,7 @@ class MatteryRecipeProvider(generatorIn: GatherDataEvent) : RecipeProvider(gener
fun plate(id: String, ingredient: Ingredient, result: Ingredient, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) { fun plate(id: String, ingredient: Ingredient, result: Ingredient, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
exec { it, callback -> exec { it, callback ->
callback.accept(modLocation("plate_$id"), PlatePressRecipe(ingredient, result, count, workTicks, experience = experience)) callback.accept(PlatePressFinishedRecipe(PlatePressRecipe(modLocation("plate_$id"), ingredient, result, count, workTicks, experience = experience)))
}
}
fun microwave(id: String, ingredient: Ingredient, result: Ingredient, count: Int = 1, workTicks: Int = 200, experience: FloatProvider = ConstantFloat.ZERO) {
exec { it, callback ->
callback.accept(modLocation("microwave/$id"), MicrowaveRecipe(ingredient, result, count, workTicks, experience = experience))
} }
} }
} }

View File

@ -1,187 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.world.item.ItemStack
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addMultiblockRecipes(consumer: RecipeOutput) {
val machinesCategory = RecipeCategory.DECORATIONS
// energy interface
MatteryRecipe(MItems.ENERGY_INPUT_INTERFACE, category = machinesCategory)
.rowB(MItems.ENERGY_BUS)
.row(MItems.ELECTRIC_PARTS, MItems.MACHINE_FRAME, MItems.ELECTRIC_PARTS)
.build(consumer)
ShapelessRecipeBuilder.shapeless(machinesCategory, ItemStack(MItems.ENERGY_INPUT_INTERFACE))
.requires(MItems.ENERGY_OUTPUT_INTERFACE)
.unlockedBy(MItems.ENERGY_OUTPUT_INTERFACE)
.unlockedBy(MItems.ENERGY_INPUT_INTERFACE)
.save(consumer, modLocation("energy_interface_to_input"))
MatteryRecipe(MItems.ENERGY_OUTPUT_INTERFACE, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItems.MACHINE_FRAME, MItems.ELECTRIC_PARTS)
.rowB(MItems.ENERGY_BUS)
.build(consumer)
ShapelessRecipeBuilder.shapeless(machinesCategory, ItemStack(MItems.ENERGY_OUTPUT_INTERFACE))
.requires(MItems.ENERGY_INPUT_INTERFACE)
.unlockedBy(MItems.ENERGY_OUTPUT_INTERFACE)
.unlockedBy(MItems.ENERGY_INPUT_INTERFACE)
.save(consumer, modLocation("energy_interface_to_output"))
// energy hatch
MatteryRecipe(MItems.ENERGY_INPUT_HATCH, category = machinesCategory)
.rowAC(MItemTags.GOLD_WIRES, MItemTags.GOLD_WIRES)
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_INPUT_INTERFACE, MItems.ELECTRIC_PARTS)
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.DILITHIUM_GEMS, Tags.Items.DUSTS_REDSTONE)
.build(consumer)
MatteryRecipe(MItems.ENERGY_OUTPUT_HATCH, category = machinesCategory)
.row(Tags.Items.DUSTS_REDSTONE, MItemTags.DILITHIUM_GEMS, Tags.Items.DUSTS_REDSTONE)
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_OUTPUT_INTERFACE, MItems.ELECTRIC_PARTS)
.rowAC(MItemTags.GOLD_WIRES, MItemTags.GOLD_WIRES)
.build(consumer)
MatteryRecipe(MItems.ENERGY_INPUT_HATCH, category = machinesCategory)
.rowB(MItems.ENERGY_OUTPUT_HATCH)
.setUpgradeSource(MItems.ENERGY_OUTPUT_HATCH)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.build(consumer, "from_output")
MatteryRecipe(MItems.ENERGY_OUTPUT_HATCH, category = machinesCategory)
.rowB(MItems.ENERGY_INPUT_HATCH)
.setUpgradeSource(MItems.ENERGY_INPUT_HATCH)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.build(consumer, "from_input")
// item hatch
MatteryRecipe(MItems.ITEM_INPUT_HATCH, category = machinesCategory)
.rowB(MItemTags.BASIC_CIRCUIT)
.row(MItems.MECHANICAL_PARTS, MItemTags.CARGO_CRATES, MItems.MECHANICAL_PARTS)
.build(consumer)
MatteryRecipe(MItems.ITEM_OUTPUT_HATCH, category = machinesCategory)
.row(MItems.MECHANICAL_PARTS, MItemTags.CARGO_CRATES, MItems.MECHANICAL_PARTS)
.rowB(MItemTags.BASIC_CIRCUIT)
.build(consumer)
ShapelessRecipeBuilder.shapeless(machinesCategory, ItemStack(MItems.ITEM_INPUT_HATCH))
.requires(MItems.ITEM_OUTPUT_HATCH)
.unlockedBy(MItems.ITEM_INPUT_HATCH)
.unlockedBy(MItems.ITEM_OUTPUT_HATCH)
.save(consumer, modLocation("item_hatch_to_input"))
ShapelessRecipeBuilder.shapeless(machinesCategory, ItemStack(MItems.ITEM_OUTPUT_HATCH))
.requires(MItems.ITEM_INPUT_HATCH)
.unlockedBy(MItems.ITEM_INPUT_HATCH)
.unlockedBy(MItems.ITEM_OUTPUT_HATCH)
.save(consumer, modLocation("item_hatch_to_output"))
// matter hatch
MatteryRecipe(MItems.MATTER_INPUT_HATCH, category = machinesCategory)
.rowB(MItems.MATTER_IO_PORT)
.row(MItems.MECHANICAL_PARTS, MItems.MACHINE_FRAME, MItems.ELECTRIC_PARTS)
.rowAC(MItems.MATTER_CAPACITOR_PARTS, MItems.MATTER_CAPACITOR_PARTS)
.build(consumer)
MatteryRecipe(MItems.MATTER_OUTPUT_HATCH, category = machinesCategory)
.rowAC(MItems.MATTER_CAPACITOR_PARTS, MItems.MATTER_CAPACITOR_PARTS)
.row(MItems.MECHANICAL_PARTS, MItems.MACHINE_FRAME, MItems.ELECTRIC_PARTS)
.rowB(MItems.MATTER_IO_PORT)
.build(consumer)
MatteryRecipe(MItems.MATTER_INPUT_HATCH, category = machinesCategory)
.rowB(MItems.MATTER_OUTPUT_HATCH)
.setUpgradeSource(MItems.MATTER_OUTPUT_HATCH)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.build(consumer, "from_output")
MatteryRecipe(MItems.MATTER_OUTPUT_HATCH, category = machinesCategory)
.rowB(MItems.MATTER_INPUT_HATCH)
.setUpgradeSource(MItems.MATTER_INPUT_HATCH)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.build(consumer, "from_input")
// misc
MatteryRecipe(MItems.GENERATOR_BLOCK, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItems.ELECTROMOTOR, MItems.ELECTRIC_PARTS)
.row(MItems.ELECTROMOTOR, MItems.MACHINE_FRAME, MItems.ELECTROMOTOR)
.row(MItems.ELECTRIC_PARTS, MItems.ELECTROMOTOR, MItems.ELECTRIC_PARTS)
.build(consumer)
MatteryRecipe(MItems.MODULAR_FRAME, count = 4, category = machinesCategory)
.row(MItemTags.IRON_PLATES, Tags.Items.INGOTS_IRON, MItemTags.IRON_PLATES)
.rowAC(Tags.Items.INGOTS_IRON, Tags.Items.INGOTS_IRON)
.row(MItemTags.IRON_PLATES, Tags.Items.INGOTS_IRON, MItemTags.IRON_PLATES)
.unlockedBy(MItemTags.IRON_PLATES)
.build(consumer)
MatteryRecipe(MItems.HEAVY_MODULAR_FRAME, count = 2, category = machinesCategory)
.row(MItems.WITHERED_STEEL, MItems.REINFORCED_IRON_PLATE, MItems.WITHERED_STEEL,)
.row(MItems.REINFORCED_IRON_PLATE, MItems.MODULAR_FRAME, MItems.REINFORCED_IRON_PLATE)
.row(MItems.WITHERED_STEEL, MItems.REINFORCED_IRON_PLATE, MItems.WITHERED_STEEL,)
.unlockedBy(MItems.MODULAR_FRAME)
.build(consumer)
// blackhole generator
MatteryRecipe(MItems.BLACK_HOLE_GENERATOR, category = machinesCategory)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.BLACK_HOLE_SCANNER, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.DILITHIUM_GEMS, MItems.MACHINE_FRAME, MItemTags.DILITHIUM_GEMS)
.row(MItems.MATTER_CAPACITOR_PARTS, Tags.Items.GEMS_DIAMOND, MItems.MATTER_CAPACITOR_PARTS)
.build(consumer)
MatteryRecipe(MItems.TRITANIUM_HULL, count = 2, category = machinesCategory)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.IRON_PLATES, MItems.MODULAR_FRAME, MItemTags.IRON_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItemTags.IRON_PLATES, MItemTags.TRITANIUM_PLATES)
.build(consumer)
MatteryRecipe(MItems.MATTER_INJECTOR, category = machinesCategory)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.MATTER_TRANSFORM_MATRIX, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.DILITHIUM_GEMS, MItems.MACHINE_FRAME, MItemTags.DILITHIUM_GEMS)
.row(MItems.MATTER_IO_PORT, MItems.GRAVITATION_FIELD_SENSOR, MItems.MATTER_IO_PORT)
.build(consumer)
MatteryRecipe(MItems.ANTIMATTER_INJECTOR, category = machinesCategory)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.ANTIMATTER_TRANSFORM_MATRIX, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.DILITHIUM_GEMS, MItems.MACHINE_FRAME, MItemTags.DILITHIUM_GEMS)
.row(MItems.MATTER_IO_PORT, MItems.GRAVITATION_FIELD_SENSOR, MItems.MATTER_IO_PORT)
.build(consumer)
MatteryRecipe(MItems.HIGH_ENERGY_PARTICLE_COLLECTOR, category = machinesCategory)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.MECHANICAL_PARTS, MItemTags.ADVANCED_CIRCUIT)
.row(Tags.Items.GEMS_QUARTZ, MItems.MACHINE_FRAME, Tags.Items.GEMS_QUARTZ)
.row(MItemTags.DILITHIUM_GEMS, MItems.GRAVITATION_FIELD_LIMITER, MItemTags.DILITHIUM_GEMS)
.build(consumer)
// flywheel
MatteryRecipe(MItems.FLYWHEEL_SHAFT, category = machinesCategory)
.row(MItemTags.TRITANIUM_PLATES, MItems.MECHANICAL_PARTS, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.MECHANICAL_PARTS, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.MECHANICAL_PARTS, MItemTags.TRITANIUM_PLATES)
.build(consumer)
MatteryRecipe(MItems.FLYWHEEL_BEARING, category = machinesCategory)
.row(MItemTags.TRITANIUM_PLATES, MItems.MECHANICAL_PARTS, MItemTags.TRITANIUM_PLATES)
.row(MItems.MECHANICAL_PARTS, MItems.MECHANICAL_PARTS, MItems.MECHANICAL_PARTS)
.row(MItemTags.TRITANIUM_PLATES, MItems.MECHANICAL_PARTS, MItemTags.TRITANIUM_PLATES)
.build(consumer)
MatteryRecipe(MItems.FLYWHEEL_HOUSING, count = 4, category = machinesCategory)
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.CARBON_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.CARBON_PLATES)
.build(consumer)
MatteryRecipe(MItems.FLYWHEEL_BATTERY, category = machinesCategory)
.row(MItemTags.ADVANCED_CIRCUIT, MItems.FLYWHEEL_HOUSING, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.GOLD_WIRES, MItemTags.COPPER_WIRES, MItemTags.GOLD_WIRES)
.build(consumer)
}

View File

@ -0,0 +1,21 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.world.item.crafting.Ingredient
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer
fun addOreSmeltingRecipes(consumer: Consumer<FinishedRecipe>) {
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("smelting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORES), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORES).save(consumer, modLocation("blasting/tritanium_ingot_from_ore_block"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 200).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("smelting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1f, 100).unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS).save(consumer, modLocation("blasting/tritanium_ingot_from_raw_ore"))
SimpleCookingRecipeBuilder.smelting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 200).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("smelting/tritanium_ingot_from_dust"))
SimpleCookingRecipeBuilder.blasting(Ingredient.of(MItemTags.TRITANIUM_DUSTS), RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 0f, 100).unlockedBy(MItemTags.TRITANIUM_DUSTS).save(consumer, modLocation("blasting/tritanium_ingot_from_dust"))
}

View File

@ -1,424 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import mekanism.api.recipes.basic.BasicPaintingRecipe
import mekanism.api.recipes.ingredients.creator.IngredientCreatorAccess
import mekanism.api.text.EnumColor
import mekanism.common.registries.MekanismChemicals
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient
import net.neoforged.fml.ModList
import net.neoforged.neoforge.common.conditions.ModLoadedCondition
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.PainterArmorDyeRecipe
import ru.dbotthepony.mc.otm.recipe.PainterRecipe
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
import ru.dbotthepony.mc.otm.registry.game.MBlocks
private val Item.recipeName get() = registryName!!.namespace + "/" + registryName!!.path
private val isMekanismLoaded by lazy {
ModList.get().isLoaded("mekanism")
}
private fun generate(consumer: RecipeOutput, items: Map<out DyeColor?, Item>, amount: Int = 1) {
for ((targetColor, targetItem) in items) {
if (targetColor == null) continue
consumer.accept(modLocation("painter/" + targetItem.recipeName), PainterRecipe(
Ingredient.of(items.entries.stream().filter { it.key != null && it.key != targetColor }.map { ItemStack(it.value) }),
ItemStack(targetItem),
mapOf(targetColor to amount, null to 15)
))
if (isMekanismLoaded) {
addMekanismPaintRecipe(consumer,
modLocation("mekanism/painter/" + targetItem.recipeName),
Ingredient.of(items.entries.stream().filter { it.key != null && it.key != targetColor }.map { ItemStack(it.value) }),
ItemStack(targetItem),
targetColor,
amount
)
}
}
}
private fun generate(consumer: RecipeOutput, default: Item, items: Map<out DyeColor?, Item>, amount: Int = 1, cleaning: Boolean = true) {
generate(consumer, items)
if (cleaning)
cleaning(consumer, default, items)
for ((k1, v1) in items) {
if (k1 == null) continue
consumer.accept(modLocation("painter/" + default.recipeName + "/" + v1.recipeName), PainterRecipe(
Ingredient.of(default),
ItemStack(v1),
mapOf(k1 to amount)
))
if (isMekanismLoaded) {
addMekanismPaintRecipe(consumer,
modLocation("mekanism/painter/" + default.recipeName + "/" + v1.recipeName),
Ingredient.of(default),
ItemStack(v1),
k1,
amount
)
}
}
}
private fun cleaning(consumer: RecipeOutput, to: Item, from: Map<out DyeColor?, Item>, suffix: String = "") {
cleaning(consumer, to, from.entries.stream().filter { it.key != null }.map { it.value }.toList(), suffix)
}
private fun cleaning(consumer: RecipeOutput, to: Item, from: Collection<Item>, suffix: String = "") {
consumer.accept(modLocation("painter/cleaning/" + to.recipeName + suffix), PainterRecipe(
Ingredient.of(from.stream().map { ItemStack(it) }),
ItemStack(to),
mapOf(null to 15)
))
}
private fun striped(consumer: RecipeOutput, name: String, items: List<Pair<Item, Pair<DyeColor, DyeColor>>>, base: Map<DyeColor, Item>) {
for ((stripeItem, colors) in items) {
val (baseColor, stripe) = colors
consumer.accept(modLocation("painter/stripes_$name/${baseColor.getName()}/${stripe.getName()}"), PainterRecipe(
Ingredient.of(base[baseColor]),
ItemStack(stripeItem),
setOf(stripe)
))
if (isMekanismLoaded) {
addMekanismPaintRecipe(consumer,
modLocation("mekanism/painter/stripes_$name/${baseColor.getName()}/${stripe.getName()}"),
Ingredient.of(base[baseColor]),
ItemStack(stripeItem),
stripe
)
}
}
}
private fun addMekanismPaintRecipe(consumer: RecipeOutput, location: ResourceLocation, input: Ingredient, output: ItemStack, dye: DyeColor, amount: Int = 1, dyeMul: Float = 0.125F) {
if (output.item.registryName?.namespace == "minecraft") return // mekanism already has painting recipes for vanilla
val color = EnumColor.entries.find{it.dyeColor == dye} ?: return
val pigment = MekanismChemicals.PIGMENT_COLOR_LOOKUP.get(color) ?: return
consumer.accept(location, BasicPaintingRecipe(
IngredientCreatorAccess.item().from(input),
IngredientCreatorAccess.chemicalStack().from(pigment, (256L * amount * dyeMul).toLong()),
output.copy(),
false
), null, ModLoadedCondition("mekanism"))
}
fun addPainterRecipes(consumer: RecipeOutput) {
generate(consumer, mapOf(
DyeColor.WHITE to Items.WHITE_WOOL,
DyeColor.ORANGE to Items.ORANGE_WOOL,
DyeColor.MAGENTA to Items.MAGENTA_WOOL,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_WOOL,
DyeColor.YELLOW to Items.YELLOW_WOOL,
DyeColor.LIME to Items.LIME_WOOL,
DyeColor.PINK to Items.PINK_WOOL,
DyeColor.GRAY to Items.GRAY_WOOL,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_WOOL,
DyeColor.CYAN to Items.CYAN_WOOL,
DyeColor.PURPLE to Items.PURPLE_WOOL,
DyeColor.BLUE to Items.BLUE_WOOL,
DyeColor.BROWN to Items.BROWN_WOOL,
DyeColor.GREEN to Items.GREEN_WOOL,
DyeColor.RED to Items.RED_WOOL,
DyeColor.BLACK to Items.BLACK_WOOL,
))
generate(consumer, mapOf(
DyeColor.WHITE to Items.WHITE_CARPET,
DyeColor.ORANGE to Items.ORANGE_CARPET,
DyeColor.MAGENTA to Items.MAGENTA_CARPET,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_CARPET,
DyeColor.YELLOW to Items.YELLOW_CARPET,
DyeColor.LIME to Items.LIME_CARPET,
DyeColor.PINK to Items.PINK_CARPET,
DyeColor.GRAY to Items.GRAY_CARPET,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_CARPET,
DyeColor.CYAN to Items.CYAN_CARPET,
DyeColor.PURPLE to Items.PURPLE_CARPET,
DyeColor.BLUE to Items.BLUE_CARPET,
DyeColor.BROWN to Items.BROWN_CARPET,
DyeColor.GREEN to Items.GREEN_CARPET,
DyeColor.RED to Items.RED_CARPET,
DyeColor.BLACK to Items.BLACK_CARPET,
))
generate(consumer, mapOf(
DyeColor.WHITE to Items.WHITE_BED,
DyeColor.ORANGE to Items.ORANGE_BED,
DyeColor.MAGENTA to Items.MAGENTA_BED,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_BED,
DyeColor.YELLOW to Items.YELLOW_BED,
DyeColor.LIME to Items.LIME_BED,
DyeColor.PINK to Items.PINK_BED,
DyeColor.GRAY to Items.GRAY_BED,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_BED,
DyeColor.CYAN to Items.CYAN_BED,
DyeColor.PURPLE to Items.PURPLE_BED,
DyeColor.BLUE to Items.BLUE_BED,
DyeColor.BROWN to Items.BROWN_BED,
DyeColor.GREEN to Items.GREEN_BED,
DyeColor.RED to Items.RED_BED,
DyeColor.BLACK to Items.BLACK_BED,
), 3)
generate(consumer, mapOf(
DyeColor.WHITE to Items.WHITE_CANDLE,
DyeColor.ORANGE to Items.ORANGE_CANDLE,
DyeColor.MAGENTA to Items.MAGENTA_CANDLE,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_CANDLE,
DyeColor.YELLOW to Items.YELLOW_CANDLE,
DyeColor.LIME to Items.LIME_CANDLE,
DyeColor.PINK to Items.PINK_CANDLE,
DyeColor.GRAY to Items.GRAY_CANDLE,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_CANDLE,
DyeColor.CYAN to Items.CYAN_CANDLE,
DyeColor.PURPLE to Items.PURPLE_CANDLE,
DyeColor.BLUE to Items.BLUE_CANDLE,
DyeColor.BROWN to Items.BROWN_CANDLE,
DyeColor.GREEN to Items.GREEN_CANDLE,
DyeColor.RED to Items.RED_CANDLE,
DyeColor.BLACK to Items.BLACK_CANDLE,
))
generate(consumer, mapOf(
DyeColor.WHITE to Items.WHITE_CONCRETE,
DyeColor.ORANGE to Items.ORANGE_CONCRETE,
DyeColor.MAGENTA to Items.MAGENTA_CONCRETE,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_CONCRETE,
DyeColor.YELLOW to Items.YELLOW_CONCRETE,
DyeColor.LIME to Items.LIME_CONCRETE,
DyeColor.PINK to Items.PINK_CONCRETE,
DyeColor.GRAY to Items.GRAY_CONCRETE,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_CONCRETE,
DyeColor.CYAN to Items.CYAN_CONCRETE,
DyeColor.PURPLE to Items.PURPLE_CONCRETE,
DyeColor.BLUE to Items.BLUE_CONCRETE,
DyeColor.BROWN to Items.BROWN_CONCRETE,
DyeColor.GREEN to Items.GREEN_CONCRETE,
DyeColor.RED to Items.RED_CONCRETE,
DyeColor.BLACK to Items.BLACK_CONCRETE,
))
generate(consumer, mapOf(
DyeColor.WHITE to Items.WHITE_CONCRETE_POWDER,
DyeColor.ORANGE to Items.ORANGE_CONCRETE_POWDER,
DyeColor.MAGENTA to Items.MAGENTA_CONCRETE_POWDER,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_CONCRETE_POWDER,
DyeColor.YELLOW to Items.YELLOW_CONCRETE_POWDER,
DyeColor.LIME to Items.LIME_CONCRETE_POWDER,
DyeColor.PINK to Items.PINK_CONCRETE_POWDER,
DyeColor.GRAY to Items.GRAY_CONCRETE_POWDER,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_CONCRETE_POWDER,
DyeColor.CYAN to Items.CYAN_CONCRETE_POWDER,
DyeColor.PURPLE to Items.PURPLE_CONCRETE_POWDER,
DyeColor.BLUE to Items.BLUE_CONCRETE_POWDER,
DyeColor.BROWN to Items.BROWN_CONCRETE_POWDER,
DyeColor.GREEN to Items.GREEN_CONCRETE_POWDER,
DyeColor.RED to Items.RED_CONCRETE_POWDER,
DyeColor.BLACK to Items.BLACK_CONCRETE_POWDER,
))
generate(consumer, MRegistry.CARGO_CRATES.item, MRegistry.CARGO_CRATES.items)
generate(consumer, MRegistry.TRITANIUM_BLOCK.item, MRegistry.TRITANIUM_BLOCK.items)
generate(consumer, MRegistry.TRITANIUM_STAIRS.item, MRegistry.TRITANIUM_STAIRS.items)
generate(consumer, MRegistry.TRITANIUM_SLAB.item, MRegistry.TRITANIUM_SLAB.items)
generate(consumer, MRegistry.TRITANIUM_WALL.item, MRegistry.TRITANIUM_WALL.items)
generate(consumer, Items.TERRACOTTA, mapOf(
DyeColor.WHITE to Items.WHITE_TERRACOTTA,
DyeColor.ORANGE to Items.ORANGE_TERRACOTTA,
DyeColor.MAGENTA to Items.MAGENTA_TERRACOTTA,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_TERRACOTTA,
DyeColor.YELLOW to Items.YELLOW_TERRACOTTA,
DyeColor.LIME to Items.LIME_TERRACOTTA,
DyeColor.PINK to Items.PINK_TERRACOTTA,
DyeColor.GRAY to Items.GRAY_TERRACOTTA,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_TERRACOTTA,
DyeColor.CYAN to Items.CYAN_TERRACOTTA,
DyeColor.PURPLE to Items.PURPLE_TERRACOTTA,
DyeColor.BLUE to Items.BLUE_TERRACOTTA,
DyeColor.BROWN to Items.BROWN_TERRACOTTA,
DyeColor.GREEN to Items.GREEN_TERRACOTTA,
DyeColor.RED to Items.RED_TERRACOTTA,
DyeColor.BLACK to Items.BLACK_TERRACOTTA,
), cleaning = false)
generate(consumer, Items.SHULKER_BOX, mapOf(
DyeColor.WHITE to Items.WHITE_SHULKER_BOX,
DyeColor.ORANGE to Items.ORANGE_SHULKER_BOX,
DyeColor.MAGENTA to Items.MAGENTA_SHULKER_BOX,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_SHULKER_BOX,
DyeColor.YELLOW to Items.YELLOW_SHULKER_BOX,
DyeColor.LIME to Items.LIME_SHULKER_BOX,
DyeColor.PINK to Items.PINK_SHULKER_BOX,
DyeColor.GRAY to Items.GRAY_SHULKER_BOX,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_SHULKER_BOX,
DyeColor.CYAN to Items.CYAN_SHULKER_BOX,
DyeColor.PURPLE to Items.PURPLE_SHULKER_BOX,
DyeColor.BLUE to Items.BLUE_SHULKER_BOX,
DyeColor.BROWN to Items.BROWN_SHULKER_BOX,
DyeColor.GREEN to Items.GREEN_SHULKER_BOX,
DyeColor.RED to Items.RED_SHULKER_BOX,
DyeColor.BLACK to Items.BLACK_SHULKER_BOX,
))
generate(consumer, Items.GLASS, mapOf(
DyeColor.WHITE to Items.WHITE_STAINED_GLASS,
DyeColor.ORANGE to Items.ORANGE_STAINED_GLASS,
DyeColor.MAGENTA to Items.MAGENTA_STAINED_GLASS,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_STAINED_GLASS,
DyeColor.YELLOW to Items.YELLOW_STAINED_GLASS,
DyeColor.LIME to Items.LIME_STAINED_GLASS,
DyeColor.PINK to Items.PINK_STAINED_GLASS,
DyeColor.GRAY to Items.GRAY_STAINED_GLASS,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_STAINED_GLASS,
DyeColor.CYAN to Items.CYAN_STAINED_GLASS,
DyeColor.PURPLE to Items.PURPLE_STAINED_GLASS,
DyeColor.BLUE to Items.BLUE_STAINED_GLASS,
DyeColor.BROWN to Items.BROWN_STAINED_GLASS,
DyeColor.GREEN to Items.GREEN_STAINED_GLASS,
DyeColor.RED to Items.RED_STAINED_GLASS,
DyeColor.BLACK to Items.BLACK_STAINED_GLASS,
))
generate(consumer, Items.GLASS_PANE, mapOf(
DyeColor.WHITE to Items.WHITE_STAINED_GLASS_PANE,
DyeColor.ORANGE to Items.ORANGE_STAINED_GLASS_PANE,
DyeColor.MAGENTA to Items.MAGENTA_STAINED_GLASS_PANE,
DyeColor.LIGHT_BLUE to Items.LIGHT_BLUE_STAINED_GLASS_PANE,
DyeColor.YELLOW to Items.YELLOW_STAINED_GLASS_PANE,
DyeColor.LIME to Items.LIME_STAINED_GLASS_PANE,
DyeColor.PINK to Items.PINK_STAINED_GLASS_PANE,
DyeColor.GRAY to Items.GRAY_STAINED_GLASS_PANE,
DyeColor.LIGHT_GRAY to Items.LIGHT_GRAY_STAINED_GLASS_PANE,
DyeColor.CYAN to Items.CYAN_STAINED_GLASS_PANE,
DyeColor.PURPLE to Items.PURPLE_STAINED_GLASS_PANE,
DyeColor.BLUE to Items.BLUE_STAINED_GLASS_PANE,
DyeColor.BROWN to Items.BROWN_STAINED_GLASS_PANE,
DyeColor.GREEN to Items.GREEN_STAINED_GLASS_PANE,
DyeColor.RED to Items.RED_STAINED_GLASS_PANE,
DyeColor.BLACK to Items.BLACK_STAINED_GLASS_PANE,
))
generate(consumer, MRegistry.INDUSTRIAL_GLASS.item, MRegistry.INDUSTRIAL_GLASS.items)
generate(consumer, MRegistry.INDUSTRIAL_GLASS_PANE.item, MRegistry.INDUSTRIAL_GLASS_PANE.items)
generate(consumer, MRegistry.DECORATIVE_CRATE.item, MRegistry.DECORATIVE_CRATE.items)
generate(consumer, MRegistry.TRITANIUM_PRESSURE_PLATE.item, MRegistry.TRITANIUM_PRESSURE_PLATE.items)
generate(consumer, MItems.TRITANIUM_DOOR[null]!!, MItems.TRITANIUM_DOOR)
generate(consumer, MItems.TRITANIUM_TRAPDOOR[null]!!, MItems.TRITANIUM_TRAPDOOR)
val blocks = listOf(
MItems.COBBLESTONE_GENERATOR,
MItems.ESSENCE_STORAGE,
MItems.TWIN_PLATE_PRESS,
MItems.ITEM_MONITOR,
MItems.MATTER_BOTTLER,
MItems.MATTER_RECONSTRUCTOR,
MItems.MATTER_REPLICATOR,
MItems.MATTER_SCANNER,
MItems.MATTER_CAPACITOR_BANK,
MItems.BATTERY_BANK,
MItems.MATTER_DECOMPOSER,
MItems.POWERED_SMOKER,
MItems.POWERED_FURNACE,
MItems.POWERED_BLAST_FURNACE,
MItems.MATTER_RECYCLER,
MItems.ANDROID_STATION,
MItems.STORAGE_POWER_SUPPLIER,
MItems.DRIVE_VIEWER,
MItems.ANDROID_CHARGER,
MItems.MATTER_PANEL,
MItems.ENERGY_SERVO,
MItems.ENERGY_COUNTER,
MItems.CHEMICAL_GENERATOR,
)
for (list in blocks) {
generate(consumer, list[null]!!,list)
}
for (i in 0 until MBlocks.TRITANIUM_ANVIL_VARIANTS) {
generate(consumer, MItems.TRITANIUM_ANVIL[null]!![i], DyeColor.entries.associateWith { MItems.TRITANIUM_ANVIL[it]!![i] })
}
generate(consumer, MRegistry.COMPUTER_TERMINAL.item, MRegistry.COMPUTER_TERMINAL.items)
generate(consumer, MRegistry.STAR_CHAIR.item, MRegistry.STAR_CHAIR.items)
generate(consumer, MRegistry.VENT.item, MRegistry.VENT.items)
generate(consumer, MRegistry.VENT_ALTERNATIVE.item, MRegistry.VENT_ALTERNATIVE.items)
generate(consumer, MItems.CARGO_CRATE_MINECARTS[null]!!, MItems.CARGO_CRATE_MINECARTS)
generate(consumer, MRegistry.UNREFINED_FLOOR_TILES.items)
generate(consumer, MRegistry.FLOOR_TILES.items)
generate(consumer, MRegistry.FLOOR_TILES_SLAB.items)
generate(consumer, MRegistry.FLOOR_TILES_STAIRS.items)
striped(consumer, "full", MRegistry.TRITANIUM_STRIPED_BLOCK.itemsWithColor, MRegistry.TRITANIUM_BLOCK.items)
striped(consumer, "stairs", MRegistry.TRITANIUM_STRIPED_STAIRS.itemsWithColor, MRegistry.TRITANIUM_STAIRS.items)
striped(consumer, "walls", MRegistry.TRITANIUM_STRIPED_WALL.itemsWithColor, MRegistry.TRITANIUM_WALL.items)
striped(consumer, "slabs", MRegistry.TRITANIUM_STRIPED_SLAB.itemsWithColor, MRegistry.TRITANIUM_SLAB.items)
for (color in DyeColor.entries) {
consumer.accept(modLocation("painter/armor_dye_" + color.getName().lowercase()), PainterArmorDyeRecipe(mapOf(color to 1)))
}
consumer.accept(modLocation("painter/armor_clear_dye"), PainterArmorDyeRecipe(mapOf(null to 15)))
generate(consumer, MItems.TRITANIUM_STRIPED_BLOCK)
generate(consumer, MItems.TRITANIUM_STRIPED_STAIRS)
generate(consumer, MItems.TRITANIUM_STRIPED_SLAB)
generate(consumer, MItems.TRITANIUM_STRIPED_WALL)
cleaning(consumer, MRegistry.TRITANIUM_BLOCK.item, MItems.TRITANIUM_STRIPED_BLOCK.values, "_from_striped")
cleaning(consumer, MRegistry.TRITANIUM_STAIRS.item, MItems.TRITANIUM_STRIPED_STAIRS.values, "_from_striped")
cleaning(consumer, MRegistry.TRITANIUM_SLAB.item, MItems.TRITANIUM_STRIPED_SLAB.values, "_from_striped")
cleaning(consumer, MRegistry.TRITANIUM_WALL.item, MItems.TRITANIUM_STRIPED_WALL.values, "_from_striped")
for (color in DyeColor.entries) {
consumer.accept(modLocation("painter/tritanium_${color.name.lowercase()}_stripe"), PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_BLOCK.item),
ItemStack(MItems.TRITANIUM_STRIPED_BLOCK[color]!!),
mapOf(color to 1)
))
consumer.accept(modLocation("painter/tritanium_${color.name.lowercase()}_stripe_stairs"), PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_STAIRS.item),
ItemStack(MItems.TRITANIUM_STRIPED_STAIRS[color]!!),
mapOf(color to 1)
))
consumer.accept(modLocation("painter/tritanium_${color.name.lowercase()}_stripe_slab"), PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_SLAB.item),
ItemStack(MItems.TRITANIUM_STRIPED_SLAB[color]!!),
mapOf(color to 1)
))
consumer.accept(modLocation("painter/tritanium_${color.name.lowercase()}_stripe_wall"), PainterRecipe(
Ingredient.of(MRegistry.TRITANIUM_WALL.item),
ItemStack(MItems.TRITANIUM_STRIPED_WALL[color]!!),
mapOf(color to 1)
))
}
generate(consumer, MItems.GRILL[null]!!, MItems.GRILL)
}

View File

@ -0,0 +1,87 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import com.google.gson.JsonObject
import com.google.gson.JsonPrimitive
import com.mojang.serialization.JsonOps
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.valueproviders.ConstantFloat
import net.minecraft.util.valueproviders.FloatProvider
import net.minecraft.util.valueproviders.UniformFloat
import net.minecraft.world.item.crafting.RecipeSerializer
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipeFactory
import ru.dbotthepony.mc.otm.core.set
import ru.dbotthepony.mc.otm.core.toJsonStrict
import ru.dbotthepony.mc.otm.data.getOrNull
class PlatePressFinishedRecipe(private val recipe: PlatePressRecipe) : FinishedRecipe {
override fun serializeRecipeData(it: JsonObject) {
it["input"] = recipe.input.toJson()
it["result"] = recipe.output.toJson().also {
if (it is JsonObject && recipe.count != 1)
it["count"] = JsonPrimitive(recipe.count)
}
it["work_time"] = JsonPrimitive(recipe.workTime)
it["experience"] = FloatProvider.CODEC.toJsonStrict(recipe.experience)
}
override fun getId(): ResourceLocation {
return recipe.id
}
override fun getType(): RecipeSerializer<*> {
return PlatePressRecipeFactory
}
override fun serializeAdvancement(): JsonObject? {
return null
}
override fun getAdvancementId(): ResourceLocation? {
return null
}
}
class PlatePressShallowFinishedRecipe(
private val id: ResourceLocation,
private val input: ResourceLocation,
private val output: ResourceLocation,
private val count: Int = 1,
private val workTime: Int = 200,
private val experience: FloatProvider = ConstantFloat.ZERO,
) : FinishedRecipe {
override fun serializeRecipeData(it: JsonObject) {
it["input"] = JsonObject().also {
it["tag"] = JsonPrimitive(input.toString())
}
it["result"] = JsonObject().also {
it["tag"] = JsonPrimitive(output.toString())
if (count != 1)
it["count"] = JsonPrimitive(count)
}
it["work_time"] = JsonPrimitive(workTime)
it["experience"] = FloatProvider.CODEC.toJsonStrict(experience)
}
override fun getId(): ResourceLocation {
return id
}
override fun getType(): RecipeSerializer<*> {
return PlatePressRecipeFactory
}
override fun serializeAdvancement(): JsonObject? {
return null
}
override fun getAdvancementId(): ResourceLocation? {
return null
}
}

View File

@ -3,12 +3,10 @@ package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.util.valueproviders.ConstantFloat import net.minecraft.util.valueproviders.ConstantFloat
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addPlatePressRecipes(provider: MatteryRecipeProvider) { fun addPlatePressRecipes(provider: MatteryRecipeProvider) {
val baselineMetals = arrayOf("iron" to 0.2f, "silver" to 0.3f, "bronze" to 0.3f, "lead" to 0.3f, "constantan" to 0.4f, "brass" to 0.3f, "nickel" to 0.5f) val baselineMetals = arrayOf("iron" to 0.2f, "silver" to 0.3f, "bronze" to 0.3f, "lead" to 0.3f, "constantan" to 0.4f, "brass" to 0.3f)
val softMetals = arrayOf("gold" to 0.4f, "aluminum" to 0.3f, "aluminium" to 0.3f, "copper" to 0.2f, "electrum" to 0.4f, "zinc" to 0.3f) val softMetals = arrayOf("gold" to 0.4f, "aluminum" to 0.3f, "aluminium" to 0.3f, "copper" to 0.2f, "electrum" to 0.4f, "zinc" to 0.3f)
val hardMetals = arrayOf("tritanium" to 0.5f, "steel" to 0.5f, "tungsten" to 0.55f, "uranium" to 0.5f) val hardMetals = arrayOf("tritanium" to 0.5f, "steel" to 0.5f, "tungsten" to 0.55f, "uranium" to 0.5f)
@ -25,5 +23,4 @@ fun addPlatePressRecipes(provider: MatteryRecipeProvider) {
} }
provider.plate("carbon", result = Ingredient.of(MItemTags.CARBON_PLATES), ingredient = Ingredient.of(Items.COAL), workTicks = 140, experience = ConstantFloat.of(0.3f)) provider.plate("carbon", result = Ingredient.of(MItemTags.CARBON_PLATES), ingredient = Ingredient.of(Items.COAL), workTicks = 140, experience = ConstantFloat.of(0.3f))
provider.plate("circuit_plating", result = Ingredient.of(MItems.CIRCUIT_PLATING), ingredient = Ingredient.of(Tags.Items.SANDS), workTicks = 120, experience = ConstantFloat.of(0.2f))
} }

View File

@ -1,42 +1,21 @@
package ru.dbotthepony.mc.otm.datagen.recipes package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapelessRecipeBuilder import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.tags.TagKey
import net.minecraft.world.item.DyeColor import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike import ru.dbotthepony.mc.otm.core.registryName
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
import java.util.function.Consumer
fun hammerRecipe(output: ItemLike, input: ItemLike, consumer: RecipeOutput) { fun addShapelessRecipes(consumer: Consumer<FinishedRecipe>) {
ShapelessRecipeBuilder(RecipeCategory.MISC, output, 1) for (color in DyeColor.values()) {
.requires(MItemTags.TOOLS_HAMMERS)
.requires(input)
.unlockedBy(MItemTags.TOOLS_HAMMERS)
.unlockedBy(input)
.save(consumer)
}
fun hammerRecipe(output: ItemLike, input: TagKey<Item>, consumer: RecipeOutput) {
ShapelessRecipeBuilder(RecipeCategory.MISC, output, 1)
.requires(MItemTags.TOOLS_HAMMERS)
.requires(input)
.unlockedBy(MItemTags.TOOLS_HAMMERS)
.unlockedBy(input)
.save(consumer)
}
fun addShapelessRecipes(consumer: RecipeOutput) {
for (color in DyeColor.entries) {
ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[color]!!, 1) ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
.requires(Items.MINECART) .requires(Items.MINECART)
.requires(MRegistry.CARGO_CRATES.items[color]!!) .requires(MRegistry.CARGO_CRATES.items[color]!!)
@ -57,60 +36,4 @@ fun addShapelessRecipes(consumer: RecipeOutput) {
.unlockedBy(Items.MINECART) .unlockedBy(Items.MINECART)
.unlockedBy(MRegistry.CARGO_CRATES.item) .unlockedBy(MRegistry.CARGO_CRATES.item)
.save(consumer) .save(consumer)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.TRITANIUM_INGOT_BLOCK, 1)
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS), 9)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.TRITANIUM_RAW_BLOCK, 1)
.requires(Ingredient.of(MItemTags.TRITANIUM_ORE_CLUMPS), 9)
.unlockedBy(MItemTags.TRITANIUM_ORE_CLUMPS)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_ORE_CLUMP, 9)
.requires(Ingredient.of(MItemTags.RAW_TRITANIUM_STORAGE))
.unlockedBy(MItemTags.RAW_TRITANIUM_STORAGE)
.save(consumer, modLocation("raw_tritanium_from_storage"))
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 9)
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS_STORAGE))
.unlockedBy(MItemTags.TRITANIUM_INGOTS_STORAGE)
.save(consumer, modLocation("tritanium_ingot_from_storage"))
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_NUGGET, 9)
.requires(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.TRITANIUM_INGOT, 1)
.requires(Ingredient.of(MItemTags.TRITANIUM_NUGGETS), 9)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_NUGGETS)
.save(consumer, modLocation("ingot_from_nuggets"))
hammerRecipe(MItems.TRITANIUM_PLATE, MItemTags.TRITANIUM_INGOTS, consumer)
hammerRecipe(MItems.IRON_PLATE, Tags.Items.INGOTS_IRON, consumer)
hammerRecipe(MItems.GOLD_PLATE, Tags.Items.INGOTS_GOLD, consumer)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.WITHERED_STEEL_BLOCK, 1)
.requires(Ingredient.of(MItems.WITHERED_STEEL), 9)
.unlockedBy(MItems.WITHERED_STEEL)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.WITHERED_STEEL, 9)
.requires(Ingredient.of(MItems.WITHERED_STEEL_BLOCK))
.unlockedBy(MItems.WITHERED_STEEL_BLOCK)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.ROFLITE_ALLOY_BLOCK, 1)
.requires(Ingredient.of(MItems.ROFLITE_ALLOY_INGOT), 9)
.unlockedBy(MItems.ROFLITE_ALLOY_INGOT)
.save(consumer)
ShapelessRecipeBuilder(RecipeCategory.MISC, MItems.ROFLITE_ALLOY_INGOT, 9)
.requires(Ingredient.of(MItems.ROFLITE_ALLOY_BLOCK))
.unlockedBy(MItems.ROFLITE_ALLOY_BLOCK)
.save(consumer)
} }

View File

@ -1,74 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addStorageItemRecipes(consumer: RecipeOutput) {
// простые батарейки
MatteryRecipe(MItems.BATTERY_CRUDE, category = RecipeCategory.MISC)
.rowB(Tags.Items.DUSTS_REDSTONE)
.rowB(Tags.Items.CROPS_POTATO)
.rowB(Tags.Items.INGOTS_IRON)
.unlockedBy(Tags.Items.CROPS_POTATO)
.build(consumer)
MatteryRecipe(MItems.BATTERY_BASIC, category = RecipeCategory.MISC)
.rowAC(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.rowB(MItems.ELECTRIC_PARTS)
.rowB(MItemTags.IRON_PLATES)
.unlockedBy(Tags.Items.DUSTS_REDSTONE)
.unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer)
MatteryRecipe(MItems.BATTERY_NORMAL, category = RecipeCategory.MISC)
.setUpgradeSource(MItems.BATTERY_BASIC)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.rowB(MItems.ELECTRIC_PARTS)
.row(MItemTags.COPPER_WIRES, MItems.BATTERY_BASIC, MItemTags.COPPER_WIRES)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.build(consumer)
MatteryRecipe(MItems.BATTERY_DENSE, category = RecipeCategory.MISC)
.setUpgradeSource(MItems.BATTERY_NORMAL)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.GOLD_WIRES, MItems.BATTERY_NORMAL, MItemTags.GOLD_WIRES)
.row(Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE, Tags.Items.DUSTS_REDSTONE)
.build(consumer)
MatteryRecipe(MItems.BATTERY_CAPACITOR, category = RecipeCategory.MISC)
.setUpgradeSource(MItems.BATTERY_NORMAL)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.row(Tags.Items.DUSTS_REDSTONE, MItems.ENERGY_BUS, Tags.Items.DUSTS_REDSTONE)
.row(MItemTags.GOLD_WIRES, MItems.BATTERY_NORMAL, MItemTags.GOLD_WIRES)
.row(MItemTags.GOLD_WIRES, Tags.Items.DUSTS_REDSTONE, MItemTags.GOLD_WIRES)
.build(consumer)
// накопители материи
MatteryRecipe(MItems.MATTER_CAPACITOR_BASIC, category = RecipeCategory.MISC)
.row(MItemTags.IRON_PLATES, MItems.MATTER_CAPACITOR_PARTS, MItemTags.HARDENED_GLASS)
.unlockedBy(MItems.MATTER_CAPACITOR_PARTS)
.build(consumer)
MatteryRecipe(MItems.MATTER_CAPACITOR_NORMAL, category = RecipeCategory.MISC)
.setUpgradeSource(MItems.MATTER_CAPACITOR_BASIC)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.rowB(MItems.MATTER_CAPACITOR_PARTS)
.row(MItemTags.TRITANIUM_PLATES, MItems.MATTER_CAPACITOR_BASIC, MItemTags.TRITANIUM_PLATES)
.rowB(Tags.Items.GEMS_DIAMOND)
.unlockedBy(MItems.MATTER_CAPACITOR_BASIC)
.build(consumer)
MatteryRecipe(MItems.MATTER_CAPACITOR_DENSE, category = RecipeCategory.MISC)
.setUpgradeSource(MItems.MATTER_CAPACITOR_NORMAL)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.row(MItems.MATTER_CAPACITOR_PARTS, MItemTags.HARDENED_GLASS, MItems.MATTER_CAPACITOR_PARTS)
.row(MItemTags.TRITANIUM_PLATES, MItems.MATTER_CAPACITOR_NORMAL, MItemTags.TRITANIUM_PLATES)
.rowAC(Tags.Items.ENDER_PEARLS, Tags.Items.ENDER_PEARLS)
.unlockedBy(MItems.MATTER_CAPACITOR_NORMAL)
.build(consumer)
}

View File

@ -1,54 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.data.recipes.SimpleCookingRecipeBuilder
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.crafting.Ingredient
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addSuspiciousRecipes(consumer: RecipeOutput) {
for (item in MItems.SUSPICIOUS_FOODS.ITEMS) {
if (item.defaultMaxStackSize == 1) {
ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, ItemStack(item))
.requires(item.mimicking())
.unlockedBy(MItems.PILL_NOT_NORMAL)
.requires(MItems.PILL_NOT_NORMAL)
.save(consumer)
} else {
ShapelessRecipeBuilder.shapeless(RecipeCategory.FOOD, ItemStack(item, 8))
.requires(item.mimicking(), 8)
.unlockedBy(MItems.PILL_NOT_NORMAL)
.requires(MItems.PILL_NOT_NORMAL)
.save(consumer)
}
}
MatteryRecipe(MItems.SUSPICIOUS_FOODS.GOLDEN_CARROT, 8, RecipeCategory.FOOD)
.row(MItems.SUSPICIOUS_FOODS.CARROT, MItems.SUSPICIOUS_FOODS.CARROT, MItems.SUSPICIOUS_FOODS.CARROT)
.row(MItems.SUSPICIOUS_FOODS.CARROT, Tags.Items.NUGGETS_GOLD, MItems.SUSPICIOUS_FOODS.CARROT)
.row(MItems.SUSPICIOUS_FOODS.CARROT, MItems.SUSPICIOUS_FOODS.CARROT, MItems.SUSPICIOUS_FOODS.CARROT)
.unlockedBy(MItems.SUSPICIOUS_FOODS.CARROT)
.build(consumer, "upgrade")
val cooking = listOf(
MItems.SUSPICIOUS_FOODS.POTATO to MItems.SUSPICIOUS_FOODS.BAKED_POTATO,
MItems.SUSPICIOUS_FOODS.BEEF to MItems.SUSPICIOUS_FOODS.COOKED_BEEF,
MItems.SUSPICIOUS_FOODS.CHICKEN to MItems.SUSPICIOUS_FOODS.COOKED_CHICKEN,
MItems.SUSPICIOUS_FOODS.COD to MItems.SUSPICIOUS_FOODS.COOKED_COD,
MItems.SUSPICIOUS_FOODS.MUTTON to MItems.SUSPICIOUS_FOODS.COOKED_MUTTON,
MItems.SUSPICIOUS_FOODS.PORKCHOP to MItems.SUSPICIOUS_FOODS.COOKED_PORKCHOP,
MItems.SUSPICIOUS_FOODS.RABBIT to MItems.SUSPICIOUS_FOODS.COOKED_RABBIT,
MItems.SUSPICIOUS_FOODS.SALMON to MItems.SUSPICIOUS_FOODS.COOKED_SALMON,
)
for ((source, target) in cooking) {
SimpleCookingRecipeBuilder.smelting(Ingredient.of(source), RecipeCategory.FOOD, target, 0.1f, 200).unlockedBy(source).save(consumer, modLocation("cooking_${source.registryName!!.path}"))
SimpleCookingRecipeBuilder.smoking(Ingredient.of(source), RecipeCategory.FOOD, target, 0.1f, 100).unlockedBy(source).save(consumer, modLocation("smoking_${source.registryName!!.path}"))
SimpleCookingRecipeBuilder.campfireCooking(Ingredient.of(source), RecipeCategory.FOOD, target, 0.1f, 600).unlockedBy(source).save(consumer, modLocation("campfire_cooking_${source.registryName!!.path}"))
}
}

View File

@ -1,68 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addToolsRecipes(consumer: RecipeOutput) {
MatteryRecipe(MItems.ENERGY_SWORD, category = RecipeCategory.COMBAT)
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
.unlockedBy(MItems.BATTERY_CAPACITOR)
.addUpgradeOps(UpgradeRecipe.CopyEnergyCharge)
.addUpgradeOps(UpgradeRecipe.CopyEnchantments)
.build(consumer)
MatteryRecipe(MItems.TRITANIUM_SWORD, category = RecipeCategory.COMBAT)
.rowB(MItemTags.TRITANIUM_INGOTS)
.rowB(MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.TRITANIUM_SHOVEL, category = RecipeCategory.TOOLS)
.rowB(MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.RODS_WOODEN)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.TRITANIUM_PICKAXE, category = RecipeCategory.TOOLS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.RODS_WOODEN)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.TRITANIUM_AXE, category = RecipeCategory.TOOLS)
.rowAB(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowAB(MItemTags.TRITANIUM_INGOTS, Tags.Items.RODS_WOODEN)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.TRITANIUM_AXE, category = RecipeCategory.TOOLS)
.rowBC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowBC(Tags.Items.RODS_WOODEN, MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer, "alt")
MatteryRecipe(MItems.TRITANIUM_HOE, category = RecipeCategory.TOOLS)
.rowBC(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.rowB(Tags.Items.RODS_WOODEN)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
MatteryRecipe(MItems.WITHERED_STEEL_SWORD, category = RecipeCategory.COMBAT)
.rowB(MItems.WITHERED_STEEL)
.rowB(MItems.WITHERED_STEEL)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(MItems.WITHERED_STEEL)
.build(consumer)
}

View File

@ -1,110 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.tags
import net.minecraft.tags.BlockTags
import net.minecraft.tags.ItemTags
import net.minecraft.world.item.Items
import net.minecraft.world.level.block.Blocks
import ru.dbotthepony.mc.otm.registry.MBlockTags
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
fun addConstructionTags(tagsProvider: TagsProvider) {
tagsProvider.blocks.Appender(BlockTags.BEACON_BASE_BLOCKS)
.add(MBlocks.TRITANIUM_INGOT_BLOCK)
.add(MBlocks.DILITHIUM_CRYSTAL_BLOCK)
.add(MBlocks.WITHERED_STEEL_BLOCK)
.add(MBlocks.ROFLITE_ALLOY_BLOCK)
tagsProvider.blocks.Appender(MBlockTags.MULTIBLOCK_STRUCTURE)
.add(MBlockTags.MULTIBLOCK_HARD_STRUCTURE, MBlockTags.MULTIBLOCK_SOFT_STRUCTURE)
tagsProvider.blocks.Appender(MBlockTags.MULTIBLOCK_SOFT_STRUCTURE)
.add(MBlockTags.HARDENED_GLASS)
tagsProvider.blocks.Appender(MBlockTags.MULTIBLOCK_HARD_STRUCTURE)
.add(MRegistry.VENT.allBlocks.values)
.add(MRegistry.VENT_ALTERNATIVE.allBlocks.values)
.add(MRegistry.TRITANIUM_BLOCK.allBlocks.values)
.add(MRegistry.TRITANIUM_STRIPED_BLOCK.blocks.values.stream().flatMap { it.values.stream() })
tagsProvider.items.Appender(MItemTags.CRAFTING_TABLES).add(Items.CRAFTING_TABLE)
tagsProvider.items.Appender(MItemTags.WORKBENCHES).add(Items.CRAFTING_TABLE)
tagsProvider.items.Appender(MItemTags.WORKBENCH).add(Items.CRAFTING_TABLE)
tagsProvider.items.Appender(MItemTags.FURNACES).add(Items.FURNACE)
tagsProvider.blocks.Appender(MBlockTags.CRAFTING_TABLES).add(Blocks.CRAFTING_TABLE)
tagsProvider.blocks.Appender(MBlockTags.WORKBENCHES).add(Blocks.CRAFTING_TABLE)
tagsProvider.blocks.Appender(MBlockTags.WORKBENCH).add(Blocks.CRAFTING_TABLE)
tagsProvider.items.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
tagsProvider.items.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.item)
tagsProvider.items.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.items.values)
tagsProvider.items.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allItems.values)
tagsProvider.items.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.item)
tagsProvider.items.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.items.values)
tagsProvider.blocks.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
tagsProvider.blocks.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.block)
tagsProvider.blocks.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.blocks.values)
tagsProvider.blocks.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values)
tagsProvider.blocks.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.block)
tagsProvider.blocks.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.blocks.values)
MRegistry.INDUSTRIAL_GLASS.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass/$s").add(item) }
MRegistry.INDUSTRIAL_GLASS_PANE.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass_panes/$s").add(item) }
MRegistry.INDUSTRIAL_GLASS.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass/$s").add(block) }
MRegistry.INDUSTRIAL_GLASS_PANE.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass_panes/$s").add(block) }
tagsProvider.items.Appender(MItemTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
tagsProvider.blocks.Appender(MBlockTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
tagsProvider.items.Appender(MItemTags.CARGO_CRATES).add(MRegistry.CARGO_CRATES.allItems.values)
tagsProvider.blocks.Appender(MBlockTags.CARGO_CRATES).add(MRegistry.CARGO_CRATES.allBlocks.values)
tagsProvider.items.Appender(ItemTags.DOORS).add(MItems.TRITANIUM_DOOR.values)
tagsProvider.blocks.Appender(BlockTags.DOORS).add(MBlocks.TRITANIUM_DOOR.values)
tagsProvider.items.Appender(ItemTags.TRAPDOORS).add(MItems.TRITANIUM_TRAPDOOR.values)
tagsProvider.blocks.Appender(BlockTags.TRAPDOORS).add(MBlocks.TRITANIUM_TRAPDOOR.values)
tagsProvider.blocks.Appender(BlockTags.PRESSURE_PLATES).add(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values)
tagsProvider.blocks.Appender(BlockTags.STAIRS)
.add(MRegistry.FLOOR_TILES_STAIRS.blocks.values)
.add(MRegistry.TRITANIUM_STAIRS.allBlocks.values)
.add(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks)
.add(MBlocks.TRITANIUM_STRIPED_STAIRS.values)
tagsProvider.blocks.Appender(BlockTags.SLABS)
.add(MRegistry.TRITANIUM_SLAB.allBlocks.values)
.add(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks)
.add(MRegistry.FLOOR_TILES_SLAB.blocks.values)
.add(MBlocks.TRITANIUM_STRIPED_SLAB.values)
tagsProvider.blocks.Appender(BlockTags.WALLS)
.add(MRegistry.TRITANIUM_WALL.allBlocks.values)
.add(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks)
.add(MBlocks.TRITANIUM_STRIPED_WALL.values)
tagsProvider.items.Appender(ItemTags.STAIRS)
.add(MRegistry.FLOOR_TILES_STAIRS.items.values)
.add(MRegistry.TRITANIUM_STAIRS.allItems.values)
.add(MRegistry.TRITANIUM_STRIPED_STAIRS.flatItems)
.add(MItems.TRITANIUM_STRIPED_STAIRS.values)
tagsProvider.items.Appender(ItemTags.SLABS)
.add(MRegistry.TRITANIUM_SLAB.allItems.values)
.add(MRegistry.TRITANIUM_STRIPED_SLAB.flatItems)
.add(MRegistry.FLOOR_TILES_SLAB.items.values)
.add(MItems.TRITANIUM_STRIPED_SLAB.values)
tagsProvider.items.Appender(ItemTags.WALLS)
.add(MRegistry.TRITANIUM_WALL.allItems.values)
.add(MRegistry.TRITANIUM_STRIPED_WALL.flatItems)
.add(MItems.TRITANIUM_STRIPED_WALL.values)
}

View File

@ -1,54 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.tags
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
fun addDyeTags(tagsProvider: TagsProvider) {
tagsProvider.addToDyeTags(MRegistry.CARGO_CRATES.allItems)
tagsProvider.addToDyeTags(MRegistry.INDUSTRIAL_GLASS.allItems)
tagsProvider.addToDyeTags(MRegistry.INDUSTRIAL_GLASS_PANE.allItems)
tagsProvider.addToDyeTags(MRegistry.DECORATIVE_CRATE.items)
tagsProvider.addToDyeTags(MItems.TRITANIUM_DOOR)
tagsProvider.addToDyeTags(MItems.TRITANIUM_TRAPDOOR)
tagsProvider.addToDyeTags(MRegistry.TRITANIUM_PRESSURE_PLATE.allItems)
tagsProvider.addToDyeTags(MRegistry.FLOOR_TILES_STAIRS.items)
tagsProvider.addToDyeTags(MRegistry.TRITANIUM_STAIRS.items)
tagsProvider.addToDyeTags(MRegistry.TRITANIUM_SLAB.items)
tagsProvider.addToDyeTags(MRegistry.FLOOR_TILES_SLAB.items)
tagsProvider.addToDyeTags(MRegistry.UNREFINED_FLOOR_TILES.items)
tagsProvider.addToDyeTags(MRegistry.TRITANIUM_WALL.items)
tagsProvider.addToDyeTags(MItems.ANDROID_STATION)
tagsProvider.addToDyeTags(MItems.ENERGY_SERVO)
tagsProvider.addToDyeTags(MItems.MATTER_DECOMPOSER)
tagsProvider.addToDyeTags(MItems.MATTER_CAPACITOR_BANK)
tagsProvider.addToDyeTags(MItems.BATTERY_BANK)
tagsProvider.addToDyeTags(MItems.MATTER_SCANNER)
tagsProvider.addToDyeTags(MItems.MATTER_PANEL)
tagsProvider.addToDyeTags(MItems.MATTER_REPLICATOR)
tagsProvider.addToDyeTags(MItems.MATTER_BOTTLER)
tagsProvider.addToDyeTags(MItems.ENERGY_COUNTER)
tagsProvider.addToDyeTags(MItems.CHEMICAL_GENERATOR)
tagsProvider.addToDyeTags(MItems.PLATE_PRESS)
tagsProvider.addToDyeTags(MItems.TWIN_PLATE_PRESS)
tagsProvider.addToDyeTags(MItems.MATTER_RECYCLER)
tagsProvider.addToDyeTags(MItems.POWERED_FURNACE)
tagsProvider.addToDyeTags(MItems.POWERED_SMOKER)
tagsProvider.addToDyeTags(MItems.POWERED_BLAST_FURNACE)
tagsProvider.addToDyeTags(MItems.DRIVE_VIEWER)
tagsProvider.addToDyeTags(MItems.ITEM_MONITOR)
tagsProvider.addToDyeTags(MItems.STORAGE_POWER_SUPPLIER)
tagsProvider.addToDyeTags(MItems.COBBLESTONE_GENERATOR)
tagsProvider.addToDyeTags(MItems.ESSENCE_STORAGE)
tagsProvider.addToDyeTags(MItems.MATTER_RECONSTRUCTOR)
tagsProvider.addToDyeTags(MItems.ANDROID_CHARGER)
}

View File

@ -1,67 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.tags
import net.minecraft.tags.ItemTags
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addEquipmentTags(tagsProvider: TagsProvider) {
// TODO: is new tag appropriate for modded armors?
tagsProvider.items.Appender(Tags.Items.ARMORS)
.add(MItems.TRITANIUM_HELMET, MItems.SIMPLE_TRITANIUM_HELMET)
.add(MItems.TRITANIUM_CHESTPLATE, MItems.SIMPLE_TRITANIUM_CHESTPLATE, MItems.PORTABLE_GRAVITATION_STABILIZER)
.add(MItems.TRITANIUM_PANTS, MItems.SIMPLE_TRITANIUM_PANTS)
.add(MItems.TRITANIUM_BOOTS, MItems.SIMPLE_TRITANIUM_BOOTS)
tagsProvider.items.Appender(ItemTags.DYEABLE).add(MItems.TRITANIUM_ARMOR)
tagsProvider.items.Appender(ItemTags.TRIMMABLE_ARMOR).add(MItems.SIMPLE_TRITANIUM_ARMOR)
tagsProvider.items.Appender(ItemTags.FREEZE_IMMUNE_WEARABLES).add(MItems.TRITANIUM_ARMOR)
tagsProvider.items.Appender(ItemTags.HEAD_ARMOR)
.add(MItems.TRITANIUM_HELMET)
.add(MItems.SIMPLE_TRITANIUM_HELMET)
tagsProvider.items.Appender(ItemTags.CHEST_ARMOR)
.add(MItems.TRITANIUM_CHESTPLATE)
.add(MItems.SIMPLE_TRITANIUM_CHESTPLATE)
tagsProvider.items.Appender(ItemTags.LEG_ARMOR)
.add(MItems.TRITANIUM_PANTS)
.add(MItems.SIMPLE_TRITANIUM_PANTS)
tagsProvider.items.Appender(ItemTags.FOOT_ARMOR)
.add(MItems.TRITANIUM_BOOTS)
.add(MItems.SIMPLE_TRITANIUM_BOOTS)
tagsProvider.items.Appender(ItemTags.SWORDS)
.add(MItems.TRITANIUM_SWORD)
.add(MItems.ENERGY_SWORD)
.add(MItems.FALLING_SUN)
.add(MItems.WITHERED_STEEL_SWORD)
tagsProvider.items.Appender(ItemTags.AXES).add(MItems.TRITANIUM_AXE)
tagsProvider.items.Appender(ItemTags.PICKAXES).add(MItems.TRITANIUM_PICKAXE)
tagsProvider.items.Appender(ItemTags.SHOVELS).add(MItems.TRITANIUM_SHOVEL)
tagsProvider.items.Appender(ItemTags.HOES).add(MItems.TRITANIUM_HOE)
tagsProvider.items.Appender(Tags.Items.TOOLS_SHEAR).add(MItems.TRITANIUM_SHEARS)
tagsProvider.items.Appender(Tags.Items.TOOLS_SHIELD).add(MItems.TRITANIUM_SHIELD)
tagsProvider.items.Appender(MItemTags.TOOLS_HAMMERS).add(MItems.EXPLOSIVE_HAMMER)
tagsProvider.items.forge("tools").add(MItemTags.TOOLS_HAMMERS)
tagsProvider.items.Appender(ItemTags.DURABILITY_ENCHANTABLE)
.add(MItems.EXPLOSIVE_HAMMER)
.add(MItems.TRITANIUM_SHEARS)
.add(MItems.TRITANIUM_SHIELD)
tagsProvider.items.Appender(ItemTags.MINING_ENCHANTABLE)
.add(MItems.TRITANIUM_SHEARS)
tagsProvider.items.Appender(ItemTags.EQUIPPABLE_ENCHANTABLE)
.add(MItems.PORTABLE_GRAVITATION_STABILIZER)
tagsProvider.items.Appender(ItemTags.VANISHING_ENCHANTABLE)
.add(MItems.PORTABLE_GRAVITATION_STABILIZER)
}

View File

@ -1,152 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.tags
import net.minecraft.world.item.Tiers
import net.minecraft.world.level.block.Block
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.MRegistry
fun addMineableTags(tagsProvider: TagsProvider) {
tagsProvider.requiresPickaxe(
MBlocks.MATTER_CABLE,
MBlocks.STORAGE_CABLE
)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_DOOR.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_TRAPDOOR.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.PAINTER, Tiers.STONE)
tagsProvider.requiresPickaxe(MBlocks.ENERGY_CABLES.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MBlocks.GRILL.values, Tiers.STONE)
tagsProvider.requiresPickaxe(listOf<Block>(
*MBlocks.ANDROID_STATION.values.toTypedArray(),
*MBlocks.BATTERY_BANK.values.toTypedArray(),
*MBlocks.MATTER_DECOMPOSER.values.toTypedArray(),
*MBlocks.MATTER_CAPACITOR_BANK.values.toTypedArray(),
MBlocks.PATTERN_STORAGE,
*MBlocks.MATTER_SCANNER.values.toTypedArray(),
*MBlocks.MATTER_PANEL.values.toTypedArray(),
*MBlocks.MATTER_REPLICATOR.values.toTypedArray(),
*MBlocks.MATTER_BOTTLER.values.toTypedArray(),
*MBlocks.ENERGY_COUNTER.values.toTypedArray(),
*MBlocks.CHEMICAL_GENERATOR.values.toTypedArray(),
*MBlocks.PLATE_PRESS.values.toTypedArray(),
*MBlocks.TWIN_PLATE_PRESS.values.toTypedArray(),
*MBlocks.MATTER_RECYCLER.values.toTypedArray(),
MBlocks.MATTER_ENTANGLER,
*MBlocks.POWERED_FURNACE.values.toTypedArray(),
*MBlocks.POWERED_SMOKER.values.toTypedArray(),
*MBlocks.POWERED_BLAST_FURNACE.values.toTypedArray(),
MBlocks.STORAGE_BUS,
MBlocks.STORAGE_IMPORTER,
MBlocks.STORAGE_EXPORTER,
*MBlocks.DRIVE_VIEWER.values.toTypedArray(),
MBlocks.DRIVE_RACK,
*MBlocks.ITEM_MONITOR.values.toTypedArray(),
*MBlocks.STORAGE_POWER_SUPPLIER.values.toTypedArray(),
MBlocks.PHANTOM_ATTRACTOR,
*MBlocks.ENERGY_SERVO.values.toTypedArray(),
MBlocks.TRITANIUM_INGOT_BLOCK,
MBlocks.WITHERED_STEEL_BLOCK,
MBlocks.METAL_JUNK,
MBlocks.METAL_MESH,
MBlocks.TRITANIUM_BARS,
MBlocks.METAL_RAILING,
MBlocks.ENGINE,
MBlocks.HOLO_SIGN,
*MBlocks.COBBLESTONE_GENERATOR.values.toTypedArray(),
*MBlocks.ESSENCE_STORAGE.values.toTypedArray(),
*MBlocks.MATTER_RECONSTRUCTOR.values.toTypedArray(),
MBlocks.FLUID_TANK,
*MBlocks.ANDROID_CHARGER.values.toTypedArray(),
MBlocks.TRITANIUM_HULL,
MBlocks.BLACK_HOLE_GENERATOR,
MBlocks.MATTER_INJECTOR,
MBlocks.ANTIMATTER_INJECTOR,
MBlocks.HIGH_ENERGY_PARTICLE_COLLECTOR,
MBlocks.ITEM_INPUT_HATCH,
MBlocks.ITEM_OUTPUT_HATCH,
MBlocks.ENERGY_INPUT_HATCH,
MBlocks.ENERGY_OUTPUT_HATCH,
MBlocks.MATTER_INPUT_HATCH,
MBlocks.MATTER_OUTPUT_HATCH,
MBlocks.ENERGY_INPUT_INTERFACE,
MBlocks.ENERGY_OUTPUT_INTERFACE,
MBlocks.FLYWHEEL_SHAFT,
MBlocks.FLYWHEEL_BEARING,
MBlocks.FLYWHEEL_HOUSING,
MBlocks.FLYWHEEL_BATTERY,
MBlocks.GENERATOR_BLOCK,
MBlocks.MODULAR_FRAME,
MBlocks.HEAVY_MODULAR_FRAME,
MBlocks.REINFORCED_REDSTONE_LAMP,
MBlocks.REINFORCED_REDSTONE_LAMP_INVERTED,
), Tiers.IRON)
tagsProvider.requiresPickaxe(listOf(
MBlocks.DILITHIUM_ORE,
MBlocks.DEEPSLATE_DILITHIUM_ORE,
MBlocks.DILITHIUM_CRYSTAL_BLOCK,
MBlocks.ROFLITE_ALLOY_BLOCK,
MBlocks.GRAVITATION_STABILIZER,
MBlocks.GRAVITATION_STABILIZER_LENS,
), Tiers.DIAMOND)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() }, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ORE, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.DEEPSLATE_TRITANIUM_ORE, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_RAW_BLOCK, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_BLOCK.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_STAIRS.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_WALL.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_SLAB.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.CARBON_FIBRE_BLOCK, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.INFINITE_WATER_SOURCE, Tiers.STONE)
tagsProvider.requiresPickaxe(MRegistry.CARGO_CRATES.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.VENT.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.VENT_ALTERNATIVE.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_BLOCK.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.COMPUTER_TERMINAL.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MRegistry.STAR_CHAIR.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_SLAB.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_WALL.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STAIRS.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_BLOCK.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.FLOOR_TILES.blocks.values)
tagsProvider.requiresPickaxe(MRegistry.FLOOR_TILES_STAIRS.blocks.values)
tagsProvider.requiresPickaxe(MRegistry.FLOOR_TILES_SLAB.blocks.values)
tagsProvider.requiresShovel(MRegistry.UNREFINED_FLOOR_TILES.blocks.values)
tagsProvider.requiresPickaxe(MRegistry.INDUSTRIAL_GLASS.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MRegistry.DECORATIVE_CRATE.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MBlocks.LABORATORY_LAMP, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.LABORATORY_LAMP_INVERTED, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.METAL_BEAM, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.METAL_BEAM_CENTER, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.DANGER_STRIPE_BLOCK)
}

View File

@ -1,61 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.tags
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addResourceTags(tagsProvider: TagsProvider) {
tagsProvider.circuits.add("basic", MItems.BASIC_CONTROL_CIRCUIT)
tagsProvider.circuits.add("advanced", MItems.ADVANCED_CONTROL_CIRCUIT)
tagsProvider.stoneOre("tritanium", MBlocks.TRITANIUM_ORE)
tagsProvider.stoneOre("dilithium", MBlocks.DILITHIUM_ORE)
tagsProvider.deepslateOre("tritanium", MBlocks.DEEPSLATE_TRITANIUM_ORE)
tagsProvider.deepslateOre("dilithium", MBlocks.DEEPSLATE_DILITHIUM_ORE)
tagsProvider.plates.add("tritanium", MItems.TRITANIUM_PLATE)
tagsProvider.plates.add("iron", MItems.IRON_PLATE)
tagsProvider.plates.add("gold", MItems.GOLD_PLATE)
tagsProvider.plates.add("carbon", MItems.CARBON_MESH)
tagsProvider.dusts.add("tritanium", MItems.TRITANIUM_DUST)
tagsProvider.ingots.add("tritanium", MItems.TRITANIUM_INGOT)
tagsProvider.ingots.add("withered_steel", MItems.WITHERED_STEEL)
tagsProvider.ingots.add("roflite_alloy", MItems.ROFLITE_ALLOY_INGOT)
tagsProvider.wires.add("copper", MItems.COPPER_WIRING)
tagsProvider.wires.add("gold", MItems.GOLD_WIRING)
tagsProvider.items.Appender(MItemTags.TRITANIUM_NUGGETS).add(MItems.TRITANIUM_NUGGET)
tagsProvider.items.Appender(MItemTags.NUGGETS).add(MItems.TRITANIUM_NUGGET)
tagsProvider.items.forge("reinforced_tritanium").add(MItems.REINFORCED_TRITANIUM_PLATE)
tagsProvider.storageBlocksAsItem.add("tritanium", MItems.TRITANIUM_INGOT_BLOCK)
tagsProvider.storageBlocksAsBlock.add("tritanium", MBlocks.TRITANIUM_INGOT_BLOCK)
tagsProvider.storageBlocksAsItem.add("withered_steel", MItems.WITHERED_STEEL_BLOCK)
tagsProvider.storageBlocksAsBlock.add("withered_steel", MBlocks.WITHERED_STEEL_BLOCK)
tagsProvider.storageBlocksAsItem.add("roflite_alloy", MItems.ROFLITE_ALLOY_BLOCK)
tagsProvider.storageBlocksAsBlock.add("roflite_alloy", MBlocks.ROFLITE_ALLOY_BLOCK)
tagsProvider.singleDropOre(
MBlocks.TRITANIUM_ORE,
MBlocks.DEEPSLATE_TRITANIUM_ORE
)
tagsProvider.denseDropOre(
MBlocks.DILITHIUM_ORE,
MBlocks.DEEPSLATE_DILITHIUM_ORE,
)
tagsProvider.clump("tritanium", MItems.TRITANIUM_ORE_CLUMP, MBlocks.TRITANIUM_RAW_BLOCK)
tagsProvider.gems.add(MItems.DILITHIUM_CRYSTAL)
tagsProvider.storageBlocksAsItem.add("dilithium", MItems.DILITHIUM_CRYSTAL_BLOCK)
tagsProvider.storageBlocksAsBlock.add("dilithium", MBlocks.DILITHIUM_CRYSTAL_BLOCK)
tagsProvider.items.forge("gems/dilithium").add(MItems.DILITHIUM_CRYSTAL)
}

View File

@ -1,14 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.tags
import ru.dbotthepony.mc.otm.registry.MStructureTags
import ru.dbotthepony.mc.otm.registry.game.MStructures
fun addStructureTags(tagsProvider: TagsProvider) {
tagsProvider.structures.Appender(MStructureTags.LABORATORIES).add(MStructures.LABORATORY)
tagsProvider.structures.Appender(MStructureTags.FIELD_RESEARCH_PODS)
.add(MStructures.FIELD_RESEARCH_POD)
.add(MStructures.FIELD_RESEARCH_POD_RUIN)
tagsProvider.structures.Appender(MStructureTags.WRECKAGES).add(MStructures.WRECKAGE)
}

View File

@ -1,68 +0,0 @@
package ru.dbotthepony.mc.otm.datagen.tags
import net.minecraft.tags.ItemTags
import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.Items
import ru.dbotthepony.mc.otm.registry.game.MItems
fun addSuspiciousTags(tagsProvider: TagsProvider) {
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.OWNED_MEAT_CONSUMERS)
.add(MItems.SUSPICIOUS_FOODS.MEAT_CONSUMERS)
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.OWNED_FISH_CONSUMERS)
.add(MItems.SUSPICIOUS_FOODS.FISH_CONSUMERS)
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.OWNED_COOKIE_CONSUMERS)
.add(MItems.SUSPICIOUS_FOODS.COOKIE_CONSUMERS)
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.OWNED_CARROT_CONSUMERS)
.add(MItems.SUSPICIOUS_FOODS.CARROT_CONSUMERS)
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.CARROT_CONSUMERS)
.add(EntityType.RABBIT)
tagsProvider.items.Appender(ItemTags.RABBIT_FOOD)
.add(MItems.SUSPICIOUS_FOODS.CARROT)
tagsProvider.items.Appender(ItemTags.WOLF_FOOD)
.add(MItems.SUSPICIOUS_FOODS.MUTTON)
.add(MItems.SUSPICIOUS_FOODS.CHICKEN)
.add(MItems.SUSPICIOUS_FOODS.BEEF)
.add(MItems.SUSPICIOUS_FOODS.RABBIT)
.add(MItems.SUSPICIOUS_FOODS.PORKCHOP)
.add(MItems.SUSPICIOUS_FOODS.COOKED_MUTTON)
.add(MItems.SUSPICIOUS_FOODS.COOKED_BEEF)
.add(MItems.SUSPICIOUS_FOODS.COOKED_CHICKEN)
.add(MItems.SUSPICIOUS_FOODS.COOKED_RABBIT)
.add(MItems.SUSPICIOUS_FOODS.COOKED_PORKCHOP)
.add(MItems.SUSPICIOUS_FOODS.ROTTEN_FLESH)
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.MEAT_CONSUMERS)
.add(EntityType.WOLF)
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.FISH_CONSUMERS)
.add(EntityType.OCELOT)
.add(EntityType.CAT)
tagsProvider.entityTypes.Appender(MItems.SUSPICIOUS_FOODS.COOKIE_CONSUMERS)
.add(EntityType.PARROT)
// Cats easily can eat cooked food and a lot of cats even PREFER to eat fish cooked,
// literally begging for fish when they smell it being cooked (and ignoring it while it lays raw)
// What mojang were thinking?
tagsProvider.items.Appender(ItemTags.OCELOT_FOOD)
.add(Items.COOKED_COD)
.add(Items.COOKED_SALMON)
.add(MItems.SUSPICIOUS_FOODS.COD)
.add(MItems.SUSPICIOUS_FOODS.COOKED_COD)
.add(MItems.SUSPICIOUS_FOODS.SALMON)
.add(MItems.SUSPICIOUS_FOODS.COOKED_SALMON)
tagsProvider.items.Appender(ItemTags.CAT_FOOD)
.add(Items.COOKED_COD)
.add(Items.COOKED_SALMON)
.add(MItems.SUSPICIOUS_FOODS.COD)
.add(MItems.SUSPICIOUS_FOODS.COOKED_COD)
.add(MItems.SUSPICIOUS_FOODS.SALMON)
.add(MItems.SUSPICIOUS_FOODS.COOKED_SALMON)
}

View File

@ -4,67 +4,227 @@ import net.minecraft.tags.BlockTags
import net.minecraft.tags.ItemTags import net.minecraft.tags.ItemTags
import net.minecraft.world.effect.MobEffects import net.minecraft.world.effect.MobEffects
import net.minecraft.world.item.Items import net.minecraft.world.item.Items
import net.neoforged.neoforge.common.Tags import net.minecraft.world.item.Tiers
import ru.dbotthepony.kommons.collect.flatMap import net.minecraft.world.level.block.Blocks
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.registry.MBlockTags import ru.dbotthepony.mc.otm.registry.MBlockTags
import ru.dbotthepony.mc.otm.registry.game.MBlocks import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.game.MFluids
import ru.dbotthepony.mc.otm.registry.MItemTags import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.game.MItems import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry import ru.dbotthepony.mc.otm.registry.MRegistry
fun addTags(tagsProvider: TagsProvider) { fun addTags(tagsProvider: TagsProvider) {
tagsProvider.items.forge("pistons").add(Items.PISTON) tagsProvider.items.forge("pistons").add(Items.PISTON)
tagsProvider.circuits.add("basic", MItems.BASIC_CONTROL_CIRCUIT)
tagsProvider.circuits.add("advanced", MItems.ADVANCED_CONTROL_CIRCUIT)
tagsProvider.items.Appender(ItemTags.BEACON_PAYMENT_ITEMS) tagsProvider.dusts.add("tritanium", MItems.TRITANIUM_DUST)
.add(MItems.TRITANIUM_INGOT) tagsProvider.ingots.add("tritanium", MItems.TRITANIUM_INGOT)
.add(MItems.DILITHIUM_CRYSTAL)
.add(MItems.WITHERED_STEEL)
.add(MItems.ROFLITE_ALLOY_INGOT)
tagsProvider.items.Appender(ItemTags.MEAT).add(MItems.NUTRIENT_PASTE) tagsProvider.plates.add("tritanium", MItems.TRITANIUM_PLATE)
tagsProvider.plates.add("iron", MItems.IRON_PLATE)
tagsProvider.plates.add("gold", MItems.GOLD_PLATE)
tagsProvider.plates.add("carbon", MItems.CARBON_MESH)
tagsProvider.fluids.forge("experience").add(MFluids.LIQUID_XP).add(MFluids.LIQUID_XP_FLOWING) tagsProvider.items.forge("reinforced_tritanium").add(MItems.REINFORCED_TRITANIUM_PLATE)
tagsProvider.fluidTypes.forge("experience").add(MFluids.LIQUID_XP_TYPE)
tagsProvider.items.Appender(MItemTags.CRAFTING_TABLES) tagsProvider.storageBlocksAsItem.add("tritanium", MItems.TRITANIUM_INGOT_BLOCK)
.add(MItemTags.WORKBENCHES) tagsProvider.storageBlocksAsBlock.add("tritanium", MBlocks.TRITANIUM_INGOT_BLOCK)
.add(MItemTags.WORKBENCH)
tagsProvider.blocks.Appender(MBlockTags.CRAFTING_TABLES) tagsProvider.stoneOre("tritanium", MBlocks.TRITANIUM_ORE)
.add(MBlockTags.WORKBENCHES) tagsProvider.deepslateOre("tritanium", MBlocks.DEEPSLATE_TRITANIUM_ORE)
.add(MBlockTags.WORKBENCH) tagsProvider.singleDropOre(
MBlocks.TRITANIUM_ORE,
MBlocks.DEEPSLATE_TRITANIUM_ORE
)
tagsProvider.clump("tritanium", MItems.TRITANIUM_ORE_CLUMP, MBlocks.TRITANIUM_RAW_BLOCK)
tagsProvider.wires.add("copper", MItems.COPPER_WIRING)
tagsProvider.wires.add("gold", MItems.GOLD_WIRING)
tagsProvider.requiresPickaxe(
MBlocks.MATTER_CABLE,
MBlocks.STORAGE_CABLE
)
tagsProvider.items.Appender(MItemTags.CRAFTING_TABLES).add(Items.CRAFTING_TABLE)
tagsProvider.blocks.Appender(MBlockTags.CRAFTING_TABLES).add(Blocks.CRAFTING_TABLE)
tagsProvider.items.Appender(MItemTags.MINECART_CARGO_CRATES).add(MItems.CARGO_CRATE_MINECARTS.values) tagsProvider.items.Appender(MItemTags.MINECART_CARGO_CRATES).add(MItems.CARGO_CRATE_MINECARTS.values)
tagsProvider.blocks.Appender(BlockTags.ANVIL).add(MBlocks.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() }) tagsProvider.items.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
tagsProvider.items.Appender(ItemTags.ANVIL).add(MItems.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() }) tagsProvider.items.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.item)
tagsProvider.items.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.items.values)
tagsProvider.items.Appender(MItemTags.UPGRADES) tagsProvider.items.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allItems.values)
.add(MItems.MachineUpgrades.Basic.LIST) tagsProvider.items.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.item)
.add(MItems.MachineUpgrades.Normal.LIST) tagsProvider.items.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.items.values)
.add(MItems.MachineUpgrades.Advanced.LIST)
.add(MItems.MachineUpgrades.Creative.LIST)
tagsProvider.items.Appender(MItemTags.NO_REPLICATION) MRegistry.INDUSTRIAL_GLASS.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass/$s").add(item) }
.add(MItemTags.DILITHIUM_GEMS) MRegistry.INDUSTRIAL_GLASS_PANE.forEachItem { s, _, item -> tagsProvider.items.forge("hardened_glass_panes/$s").add(item) }
.add(MItemTags.DILITHIUM_ORES)
.add(Items.WRITTEN_BOOK) tagsProvider.blocks.forge("hardened_glass").add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
.add(Tags.Items.ORES) tagsProvider.blocks.forge("hardened_glass/colorless").add(MRegistry.INDUSTRIAL_GLASS.block)
.add(Tags.Items.RAW_MATERIALS) tagsProvider.blocks.forge("hardened_glass/tinted").add(MRegistry.INDUSTRIAL_GLASS.blocks.values)
.add(MItems.PILL_ANDROID)
.add(MItems.PILL_HUMANE) tagsProvider.blocks.forge("hardened_glass_panes").add(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values)
.add(MItems.PILL_OBLIVION) tagsProvider.blocks.forge("hardened_glass_panes/colorless").add(MRegistry.INDUSTRIAL_GLASS_PANE.block)
.add(MItems.QUANTUM_BATTERY) tagsProvider.blocks.forge("hardened_glass_panes/tinted").add(MRegistry.INDUSTRIAL_GLASS_PANE.blocks.values)
.add(MItems.QUANTUM_CAPACITOR)
.add(MItems.QUANTUM_BATTERY_CREATIVE) MRegistry.INDUSTRIAL_GLASS.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass/$s").add(block) }
.add(MItems.ZPM_BATTERY) MRegistry.INDUSTRIAL_GLASS_PANE.forEachBlock { s, _, block -> tagsProvider.blocks.forge("hardened_glass_panes/$s").add(block) }
.add(MItems.PROCEDURAL_BATTERY)
.add(MItems.EXOPACK_PROBE) tagsProvider.items.Appender(MItemTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allItems.values)
.add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) tagsProvider.blocks.Appender(MBlockTags.INDUSTRIAL_GLASS).add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
.add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_WITHER) tagsProvider.blocks.Appender(MBlockTags.CARGO_CRATES).add(MRegistry.CARGO_CRATES.allBlocks.values)
.add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON)
tagsProvider.items.Appender(ItemTags.DOORS).add(MItems.TRITANIUM_DOOR.values)
tagsProvider.blocks.Appender(BlockTags.DOORS).add(MBlocks.TRITANIUM_DOOR.values)
tagsProvider.items.Appender(ItemTags.TRAPDOORS).add(MItems.TRITANIUM_TRAPDOOR.values)
tagsProvider.blocks.Appender(BlockTags.TRAPDOORS).add(MBlocks.TRITANIUM_TRAPDOOR.values)
tagsProvider.blocks.Appender(BlockTags.PRESSURE_PLATES).add(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values)
tagsProvider.items.Appender(MItemTags.MACHINES).add(MItems.MACHINES)
tagsProvider.blocks.Appender(MBlockTags.MACHINES).add(MItems.MACHINES.stream().map { it!!.block })
tagsProvider.blocks.Appender(BlockTags.ANVIL).add(MBlocks.TRITANIUM_ANVIL)
tagsProvider.items.Appender(MItemTags.TRITANIUM_NUGGETS).add(MItems.TRITANIUM_NUGGET)
tagsProvider.items.Appender(MItemTags.NUGGETS).add(MItems.TRITANIUM_NUGGET)
tagsProvider.items.forge("armors")
.add("helmets", MItems.TRITANIUM_HELMET)
.add("chestplates", MItems.TRITANIUM_CHESTPLATE)
.add("leggings", MItems.TRITANIUM_PANTS)
.add("boots", MItems.TRITANIUM_BOOTS)
.add("helmets", MItems.SIMPLE_TRITANIUM_HELMET)
.add("chestplates", MItems.SIMPLE_TRITANIUM_CHESTPLATE)
.add("leggings", MItems.SIMPLE_TRITANIUM_PANTS)
.add("boots", MItems.SIMPLE_TRITANIUM_BOOTS)
tagsProvider.items.minecraft("swords").add(MItems.TRITANIUM_SWORD)
tagsProvider.items.minecraft("axes").add(MItems.TRITANIUM_AXE)
tagsProvider.items.minecraft("pickaxes").add(MItems.TRITANIUM_PICKAXE)
tagsProvider.items.minecraft("shovels").add(MItems.TRITANIUM_SHOVEL)
tagsProvider.items.minecraft("hoes").add(MItems.TRITANIUM_HOE)
tagsProvider.items.forge("shears").add(MItems.TRITANIUM_SHEARS)
tagsProvider.items.forge("shields").add(MItems.TRITANIUM_SHIELD)
tagsProvider.blocks.Appender(BlockTags.STAIRS)
.add(MRegistry.FLOOR_TILES_STAIRS.blocks.values)
.add(MRegistry.TRITANIUM_STAIRS.allBlocks.values)
.add(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks)
.add(MBlocks.TRITANIUM_STRIPED_STAIRS)
tagsProvider.blocks.Appender(BlockTags.SLABS)
.add(MRegistry.TRITANIUM_SLAB.allBlocks.values)
.add(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks)
.add(MRegistry.FLOOR_TILES_SLAB.blocks.values)
.add(MBlocks.TRITANIUM_STRIPED_SLAB)
tagsProvider.blocks.Appender(BlockTags.WALLS)
.add(MRegistry.TRITANIUM_WALL.allBlocks.values)
.add(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks)
.add(MBlocks.TRITANIUM_STRIPED_WALL)
tagsProvider.items.Appender(ItemTags.SLABS)
.add(MRegistry.TRITANIUM_SLAB.allItems.values)
.add(MRegistry.TRITANIUM_STRIPED_SLAB.flatItems)
.add(MRegistry.FLOOR_TILES_SLAB.items.values)
.add(MItems.TRITANIUM_STRIPED_SLAB)
tagsProvider.items.Appender(ItemTags.WALLS)
.add(MRegistry.TRITANIUM_WALL.allItems.values)
.add(MRegistry.TRITANIUM_STRIPED_WALL.flatItems)
.add(MItems.TRITANIUM_STRIPED_WALL)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_DOOR.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_TRAPDOOR.values, Tiers.IRON)
tagsProvider.requiresPickaxe(listOf(
MBlocks.ANDROID_STATION,
MBlocks.BATTERY_BANK,
MBlocks.MATTER_DECOMPOSER,
MBlocks.MATTER_CAPACITOR_BANK,
MBlocks.PATTERN_STORAGE,
MBlocks.MATTER_SCANNER,
MBlocks.MATTER_PANEL,
MBlocks.MATTER_REPLICATOR,
MBlocks.MATTER_BOTTLER,
MBlocks.ENERGY_COUNTER,
MBlocks.CHEMICAL_GENERATOR,
MBlocks.PLATE_PRESS,
MBlocks.MATTER_RECYCLER,
MBlocks.STORAGE_BUS,
MBlocks.STORAGE_IMPORTER,
MBlocks.STORAGE_EXPORTER,
MBlocks.DRIVE_VIEWER,
MBlocks.DRIVE_RACK,
MBlocks.ITEM_MONITOR,
MBlocks.STORAGE_POWER_SUPPLIER,
MBlocks.PHANTOM_ATTRACTOR,
MBlocks.ENERGY_SERVO,
MBlocks.TRITANIUM_INGOT_BLOCK,
MBlocks.TRITANIUM_BARS,
MBlocks.ENGINE,
MBlocks.HOLO_SIGN,
MBlocks.COBBLESTONE_GENERATOR,
MBlocks.ESSENCE_STORAGE,
MBlocks.MATTER_RECONSTRUCTOR,
MBlocks.FLUID_TANK,
), Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ANVIL, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_ORE, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.DEEPSLATE_TRITANIUM_ORE, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_RAW_BLOCK, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_BLOCK, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_STAIRS, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_WALL, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.TRITANIUM_STRIPED_SLAB, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.CARBON_FIBRE_BLOCK, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.CARGO_CRATES.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.VENT.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.VENT_ALTERNATIVE.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_BLOCK.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_SLAB.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_WALL.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_PRESSURE_PLATE.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STAIRS.allBlocks.values, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_BLOCK.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_STAIRS.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_WALL.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.TRITANIUM_STRIPED_SLAB.flatBlocks, Tiers.IRON)
tagsProvider.requiresPickaxe(MRegistry.FLOOR_TILES.blocks.values)
tagsProvider.requiresPickaxe(MRegistry.FLOOR_TILES_STAIRS.blocks.values)
tagsProvider.requiresPickaxe(MRegistry.FLOOR_TILES_SLAB.blocks.values)
tagsProvider.requiresShovel(MRegistry.UNREFINED_FLOOR_TILES.blocks.values)
tagsProvider.requiresPickaxe(MRegistry.INDUSTRIAL_GLASS.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MRegistry.DECORATIVE_CRATE.allBlocks.values, Tiers.STONE)
tagsProvider.requiresPickaxe(MBlocks.LABORATORY_LAMP, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.LABORATORY_LAMP_INVERTED, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.METAL_BEAM, Tiers.IRON)
tagsProvider.requiresPickaxe(MBlocks.DANGER_STRIPE_BLOCK)
tagsProvider.requiresPickaxe(listOf(
MBlocks.GRAVITATION_STABILIZER,
MBlocks.GRAVITATION_STABILIZER_LENS,
), Tiers.DIAMOND)
tagsProvider.dragonImmune.add( tagsProvider.dragonImmune.add(
MBlocks.BLACK_HOLE, MBlocks.BLACK_HOLE,
@ -76,12 +236,6 @@ fun addTags(tagsProvider: TagsProvider) {
MBlocks.BLACK_HOLE, MBlocks.BLACK_HOLE,
) )
tagsProvider.guardedByPiglins.add(
MBlockTags.CARGO_CRATES,
)
tagsProvider.impermeable.add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
tagsProvider.androidImmuneEffects.add( tagsProvider.androidImmuneEffects.add(
MobEffects.CONDUIT_POWER, MobEffects.CONDUIT_POWER,
MobEffects.HEAL, MobEffects.HEAL,
@ -98,9 +252,4 @@ fun addTags(tagsProvider: TagsProvider) {
MobEffects.DOLPHINS_GRACE, MobEffects.DOLPHINS_GRACE,
MobEffects.CONFUSION, MobEffects.CONFUSION,
) )
tagsProvider.androidImmuneEffects.add(
ResourceLocation("rats", "plague"),
ResourceLocation("rats", "synesthesia"),
)
} }

View File

@ -1,7 +1,6 @@
package ru.dbotthepony.mc.otm.datagen.tags package ru.dbotthepony.mc.otm.datagen.tags
import it.unimi.dsi.fastutil.objects.ObjectArraySet import it.unimi.dsi.fastutil.objects.ObjectArraySet
import net.minecraft.core.Holder
import net.minecraft.core.HolderLookup import net.minecraft.core.HolderLookup
import net.minecraft.core.Registry import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries import net.minecraft.core.registries.BuiltInRegistries
@ -11,18 +10,15 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.BlockTags import net.minecraft.tags.BlockTags
import net.minecraft.tags.GameEventTags import net.minecraft.tags.GameEventTags
import net.minecraft.tags.TagKey import net.minecraft.tags.TagKey
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item import net.minecraft.world.item.Item
import net.minecraft.world.item.Tier import net.minecraft.world.item.Tier
import net.minecraft.world.item.Tiers import net.minecraft.world.item.Tiers
import net.minecraft.world.level.block.Block import net.minecraft.world.level.block.Block
import net.neoforged.neoforge.common.Tags import net.minecraftforge.data.event.GatherDataEvent
import net.neoforged.neoforge.data.event.GatherDataEvent import net.minecraftforge.registries.ForgeRegistries
import net.neoforged.neoforge.registries.NeoForgeRegistries import net.minecraftforge.registries.IForgeRegistry
import ru.dbotthepony.mc.otm.player.MatteryPlayer import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.datagen.DataGen import ru.dbotthepony.mc.otm.datagen.DataGen
import java.util.EnumMap
import java.util.stream.Stream import java.util.stream.Stream
import net.minecraft.data.tags.TagsProvider as MinecraftTagsProvider import net.minecraft.data.tags.TagsProvider as MinecraftTagsProvider
@ -33,7 +29,7 @@ private fun <T : Any> vanillaLookup(key: ResourceKey<Registry<T>>): (T) -> Resou
class TagsProvider(private val event: GatherDataEvent) { class TagsProvider(private val event: GatherDataEvent) {
inner class Delegate<T : Any> private constructor(key: ResourceKey<Registry<T>>, val lookup: (T) -> ResourceLocation) : MinecraftTagsProvider<T>(event.generator.packOutput, key, event.lookupProvider, DataGen.MOD_ID, event.existingFileHelper) { inner class Delegate<T : Any> private constructor(key: ResourceKey<Registry<T>>, val lookup: (T) -> ResourceLocation) : MinecraftTagsProvider<T>(event.generator.packOutput, key, event.lookupProvider, DataGen.MOD_ID, event.existingFileHelper) {
constructor(registry: Registry<T>) : this(registry.key() as ResourceKey<Registry<T>>, { registry.getKey(it) ?: throw NoSuchElementException("$it is not registered in $registry") }) constructor(registry: IForgeRegistry<T>) : this(registry.registryKey, { registry.getKey(it) ?: throw NoSuchElementException("Registry $registry does not contain $it") })
constructor(key: ResourceKey<Registry<T>>) : this(key, vanillaLookup(key)) constructor(key: ResourceKey<Registry<T>>) : this(key, vanillaLookup(key))
init { init {
@ -95,11 +91,6 @@ class TagsProvider(private val event: GatherDataEvent) {
return this return this
} }
fun add(vararg values: Holder<T>): Appender {
for (value in values) add(value.key ?: throw IllegalArgumentException("Intrusive holder"))
return this
}
fun add(vararg values: TagKey<T>): Appender { fun add(vararg values: TagKey<T>): Appender {
for (value in values) add(value) for (value in values) add(value)
return this return this
@ -115,11 +106,6 @@ class TagsProvider(private val event: GatherDataEvent) {
return this return this
} }
fun add(values: Iterator<T>): Appender {
values.forEach { add(it) }
return this
}
fun leaf(name: String) = Appender(TagKey.create(tag.registry, ResourceLocation(tag.location.namespace, tag.location.path + "/$name"))) fun leaf(name: String) = Appender(TagKey.create(tag.registry, ResourceLocation(tag.location.namespace, tag.location.path + "/$name")))
fun add(leaf: String, value: T) = also { leaf(leaf).add(value) } fun add(leaf: String, value: T) = also { leaf(leaf).add(value) }
@ -133,7 +119,7 @@ class TagsProvider(private val event: GatherDataEvent) {
fun add(leaf: String, vararg value: ResourceLocation) = also { leaf(leaf).add(*value) } fun add(leaf: String, vararg value: ResourceLocation) = also { leaf(leaf).add(*value) }
} }
fun forge(path: String) = Appender(ResourceLocation("c", path)) fun forge(path: String) = Appender(ResourceLocation("forge", path))
fun minecraft(path: String) = Appender(ResourceLocation("minecraft", path)) fun minecraft(path: String) = Appender(ResourceLocation("minecraft", path))
override fun addTags(provider: HolderLookup.Provider) { override fun addTags(provider: HolderLookup.Provider) {
@ -157,7 +143,7 @@ class TagsProvider(private val event: GatherDataEvent) {
val appender = tag(tag) val appender = tag(tag)
for (value in values) { for (value in values) {
appender.addOptionalTag(value) appender.addTag(value)
} }
} }
} }
@ -178,32 +164,12 @@ class TagsProvider(private val event: GatherDataEvent) {
} }
} }
val blocks = Delegate(BuiltInRegistries.BLOCK) val blocks = Delegate(ForgeRegistries.BLOCKS)
val items = Delegate(BuiltInRegistries.ITEM) val items = Delegate(ForgeRegistries.ITEMS)
val fluids = Delegate(BuiltInRegistries.FLUID) val mobEffects = Delegate(ForgeRegistries.MOB_EFFECTS)
val fluidTypes = Delegate(NeoForgeRegistries.Keys.FLUID_TYPES)
val mobEffects = Delegate(BuiltInRegistries.MOB_EFFECT)
val entityTypes = Delegate(BuiltInRegistries.ENTITY_TYPE)
val damageTypes = Delegate(Registries.DAMAGE_TYPE) val damageTypes = Delegate(Registries.DAMAGE_TYPE)
val structures = Delegate(Registries.STRUCTURE)
private val coloredItems = EnumMap<DyeColor, Delegate<Item>.Appender>(DyeColor::class.java) val androidImmuneEffects = mobEffects.Appender(MatteryPlayerCapability.ANDROID_IMMUNE_EFFECTS)
init {
DyeColor.entries.forEach {
coloredItems[it] = items.Appender(it.dyedTag)
}
}
fun addToDyeTags(values: Map<out DyeColor?, Item>) {
for ((c, it) in values) {
if (c != null) {
coloredItems[c]!!.add(it)
}
}
}
val androidImmuneEffects = mobEffects.Appender(MatteryPlayer.ANDROID_IMMUNE_EFFECTS)
val requiresShovel = blocks.Appender(BlockTags.MINEABLE_WITH_SHOVEL) val requiresShovel = blocks.Appender(BlockTags.MINEABLE_WITH_SHOVEL)
val requiresAxe = blocks.Appender(BlockTags.MINEABLE_WITH_AXE) val requiresAxe = blocks.Appender(BlockTags.MINEABLE_WITH_AXE)
@ -216,8 +182,6 @@ class TagsProvider(private val event: GatherDataEvent) {
val witherImmune = blocks.Appender(BlockTags.WITHER_IMMUNE) val witherImmune = blocks.Appender(BlockTags.WITHER_IMMUNE)
val dragonImmune = blocks.Appender(BlockTags.DRAGON_IMMUNE) val dragonImmune = blocks.Appender(BlockTags.DRAGON_IMMUNE)
val guardedByPiglins = blocks.Appender(BlockTags.GUARDED_BY_PIGLINS)
val impermeable = blocks.Appender(BlockTags.IMPERMEABLE)
fun stoneOre(key: String, block: Block): TagsProvider { fun stoneOre(key: String, block: Block): TagsProvider {
ore(key, block) ore(key, block)
@ -246,17 +210,8 @@ class TagsProvider(private val event: GatherDataEvent) {
return this return this
} }
fun denseDropOre(vararg blocks: Block): TagsProvider {
for (block in blocks) {
itemOreRatesSingular.add(block.asItem())
blockOreRatesSingular.add(block)
}
return this
}
fun ore(key: String, block: Block): TagsProvider { fun ore(key: String, block: Block): TagsProvider {
val forgeKey = ResourceLocation("c", "ores/$key") val forgeKey = ResourceLocation("forge", "ores/$key")
val b = TagKey.create(Registries.BLOCK, forgeKey) val b = TagKey.create(Registries.BLOCK, forgeKey)
val i = TagKey.create(Registries.ITEM, forgeKey) val i = TagKey.create(Registries.ITEM, forgeKey)
@ -288,30 +243,29 @@ class TagsProvider(private val event: GatherDataEvent) {
} }
val circuits = items.forge("circuits") val circuits = items.forge("circuits")
val dusts = items.Appender(Tags.Items.DUSTS) val dusts = items.forge("dusts")
val ingots = items.Appender(Tags.Items.INGOTS) val ingots = items.forge("ingots")
val itemOres = items.Appender(Tags.Items.ORES) val itemOres = items.forge("ores")
val gems = items.Appender(Tags.Items.GEMS) val blockOres = blocks.forge("ores")
val blockOres = blocks.Appender(Tags.Blocks.ORES)
val plates = items.forge("plates") val plates = items.forge("plates")
val storageBlocksAsItem = items.Appender(Tags.Items.STORAGE_BLOCKS) val storageBlocksAsItem = items.forge("storage_blocks")
val storageBlocksAsBlock = blocks.Appender(Tags.Blocks.STORAGE_BLOCKS) val storageBlocksAsBlock = blocks.forge("storage_blocks")
val rawMaterials = items.Appender(Tags.Items.RAW_MATERIALS) val rawMaterials = items.forge("raw_materials")
val wires = items.forge("wires") val wires = items.forge("wires")
val blockGroundOresStone = blocks.Appender(Tags.Blocks.ORES_IN_GROUND_STONE) val blockGroundOresStone = blocks.forge("ores_in_ground/stone")
val blockGroundOresDeepslate = blocks.Appender(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE) val blockGroundOresDeepslate = blocks.forge("ores_in_ground/deepslate")
// val blockGroundOresNetherrack = blocks.forge("ores_in_ground/netherrack") // val blockGroundOresNetherrack = blocks.forge("ores_in_ground/netherrack")
val itemGroundOresStone = items.Appender(Tags.Items.ORES_IN_GROUND_STONE) val itemGroundOresStone = items.forge("ores_in_ground/stone")
val itemGroundOresDeepslate = items.Appender(Tags.Items.ORES_IN_GROUND_DEEPSLATE) val itemGroundOresDeepslate = items.forge("ores_in_ground/deepslate")
// val itemGroundOresNetherrack = items.forge("ores_in_ground/netherrack") // val itemGroundOresNetherrack = items.forge("ores_in_ground/netherrack")
// val blockOreRatesSparse = blocks.forge("ore_rates/sparse") // val blockOreRatesSparse = blocks.forge("ore_rates/sparse")
val blockOreRatesSingular = blocks.Appender(Tags.Blocks.ORE_RATES_SINGULAR) val blockOreRatesSingular = blocks.forge("ore_rates/singular")
val blockOreRatesDense = blocks.forge("ore_rates/dense") // val blockOreRatesDense = blocks.forge("ore_rates/dense")
// val itemOreRatesSparse = items.forge("ore_rates/sparse") // val itemOreRatesSparse = items.forge("ore_rates/sparse")
val itemOreRatesSingular = items.Appender(Tags.Items.ORE_RATES_SINGULAR) val itemOreRatesSingular = items.forge("ore_rates/singular")
val itemOreRatesDense = items.forge("ore_rates/dense") // val itemOreRatesDense = items.forge("ore_rates/dense")
val gameEvents = Delegate(Registries.GAME_EVENT) val gameEvents = Delegate(Registries.GAME_EVENT)
val vibrations = gameEvents.Appender(GameEventTags.VIBRATIONS) val vibrations = gameEvents.Appender(GameEventTags.VIBRATIONS)
@ -333,16 +287,6 @@ class TagsProvider(private val event: GatherDataEvent) {
return this return this
} }
fun requiresPickaxe(blocks: Stream<Block>, tier: Tier? = null): TagsProvider {
for (block in blocks) requiresPickaxe(block, tier)
return this
}
fun requiresPickaxe(blocks: Iterator<Block>, tier: Tier? = null): TagsProvider {
for (block in blocks) requiresPickaxe(block, tier)
return this
}
fun requiresPickaxe(vararg blocks: Block, tier: Tier? = null): TagsProvider { fun requiresPickaxe(vararg blocks: Block, tier: Tier? = null): TagsProvider {
for (block in blocks) requiresPickaxe(block, tier) for (block in blocks) requiresPickaxe(block, tier)
return this return this

View File

@ -0,0 +1,260 @@
package ru.dbotthepony.mc.otm;
import kotlin.KotlinVersion;
import net.minecraft.MethodsReturnNonnullByDefault;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.ModList;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.NotNull;
import ru.dbotthepony.mc.otm.android.AndroidResearchManager;
import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature;
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity;
import ru.dbotthepony.mc.otm.block.entity.blackhole.ExplosionQueue;
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability;
import ru.dbotthepony.mc.otm.capability.drive.DrivePool;
import ru.dbotthepony.mc.otm.client.AndroidAbilityKeyMapping;
import ru.dbotthepony.mc.otm.client.AndroidMenuKeyMapping;
import ru.dbotthepony.mc.otm.client.ClientEventHandlerKt;
import ru.dbotthepony.mc.otm.client.ClientTickHandlerKt;
import ru.dbotthepony.mc.otm.client.MatteryGUI;
import ru.dbotthepony.mc.otm.client.model.ExosuitModel;
import ru.dbotthepony.mc.otm.client.model.GravitationStabilizerModel;
import ru.dbotthepony.mc.otm.client.model.TritaniumArmorModel;
import ru.dbotthepony.mc.otm.client.render.ShockwaveRenderer;
import ru.dbotthepony.mc.otm.client.render.blockentity.BatteryBankRenderer;
import ru.dbotthepony.mc.otm.client.render.blockentity.MatterBatteryBankRenderer;
import ru.dbotthepony.mc.otm.compat.adastra.AdAstraCompatKt;
import ru.dbotthepony.mc.otm.compat.curios.CuriosCompatKt;
import ru.dbotthepony.mc.otm.compat.mekanism.QIOKt;
import ru.dbotthepony.mc.otm.compat.mekanism.TooltipsKt;
import ru.dbotthepony.mc.otm.config.AndroidConfig;
import ru.dbotthepony.mc.otm.config.ClientConfig;
import ru.dbotthepony.mc.otm.config.ItemsConfig;
import ru.dbotthepony.mc.otm.config.MachinesConfig;
import ru.dbotthepony.mc.otm.config.ServerCompatConfig;
import ru.dbotthepony.mc.otm.config.ServerConfig;
import ru.dbotthepony.mc.otm.config.ToolsConfig;
import ru.dbotthepony.mc.otm.core.math.Decimal;
import ru.dbotthepony.mc.otm.item.tool.ExplosiveHammerItem;
import ru.dbotthepony.mc.otm.item.armor.TritaniumArmorItem;
import ru.dbotthepony.mc.otm.item.QuantumBatteryItem;
import ru.dbotthepony.mc.otm.item.weapon.AbstractWeaponItem;
import ru.dbotthepony.mc.otm.item.PortableCondensationDriveItem;
import ru.dbotthepony.mc.otm.matter.MatterManager;
import ru.dbotthepony.mc.otm.network.*;
import ru.dbotthepony.mc.otm.registry.*;
import ru.dbotthepony.mc.otm.storage.*;
import ru.dbotthepony.mc.otm.triggers.KillAsAndroidTrigger;
import top.theillusivec4.curios.api.CuriosApi;
import static net.minecraftforge.common.MinecraftForge.EVENT_BUS;
import javax.annotation.ParametersAreNonnullByDefault;
import java.util.Objects;
// The value here should match an entry in the META-INF/mods.toml file
@Mod(OverdriveThatMatters.MOD_ID)
@ParametersAreNonnullByDefault
@MethodsReturnNonnullByDefault
public final class OverdriveThatMatters {
// Directly reference a log4j logger.
public static final String MOD_ID = "overdrive_that_matters";
private static final Logger LOGGER = LogManager.getLogger();
public static OverdriveThatMatters INSTANCE;
private StorageStackType<ItemStackWrapper> ITEM_STORAGE;
@NotNull
public StorageStackType<ItemStackWrapper> ITEM_STORAGE() {
return Objects.requireNonNull(ITEM_STORAGE);
}
public static ResourceLocation loc(String path) {
return new ResourceLocation(MOD_ID, path);
}
private static void checkIfKotlinIsInstalled() {
if (!KotlinVersion.CURRENT.isAtLeast(1, 8, 0)) {
throw new UnsupportedClassVersionError("Installed kotlin version is " + KotlinVersion.CURRENT + ", when at least 1.8.0 is required.");
}
}
public OverdriveThatMatters() {
if (INSTANCE != null) {
throw new IllegalStateException("yo what the fuck");
}
try {
checkIfKotlinIsInstalled();
} catch (Throwable err) {
if (err instanceof NoClassDefFoundError) {
for (int i = 0; i < 16; i++)
LOGGER.fatal("Overdrive That Matters requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
LOGGER.fatal("Overdrive That Matters requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err);
throw new RuntimeException("Overdrive That Matters requires Kotlin to be installed, get Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
}
for (int i = 0; i < 16; i++)
LOGGER.fatal("Overdrive That Matters' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge");
LOGGER.fatal("Overdrive That Matters' Kotlin version is not satisfied, get newer Kotlin for Forge from https://github.com/thedarkcolour/KotlinForForge", err);
throw err;
}
INSTANCE = this;
var modBus = FMLJavaModLoadingContext.get().getModEventBus();
MRegistry.INSTANCE.initialize(modBus);
MatterManager.INSTANCE.initialize(modBus);
modBus.addListener(EventPriority.HIGHEST, this::setup);
modBus.addListener(EventPriority.NORMAL, this::setupClient);
modBus.addListener(EventPriority.NORMAL, MatteryCapability::register);
DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> {
modBus.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping.INSTANCE::register);
modBus.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::register);
modBus.addListener(EventPriority.NORMAL, TritaniumArmorModel::register);
modBus.addListener(EventPriority.NORMAL, GravitationStabilizerModel::register);
modBus.addListener(EventPriority.NORMAL, MCreativeTabs.INSTANCE::register);
modBus.addListener(EventPriority.NORMAL, BatteryBankRenderer.Companion::onRegisterAdditionalModels);
modBus.addListener(EventPriority.NORMAL, MatterBatteryBankRenderer.Companion::onRegisterAdditionalModels);
});
ClientConfig.INSTANCE.register();
ServerConfig.INSTANCE.register();
ServerCompatConfig.INSTANCE.register();
AndroidConfig.INSTANCE.register();
ItemsConfig.INSTANCE.register();
MachinesConfig.INSTANCE.register();
ToolsConfig.INSTANCE.register();
}
private void setup(final FMLCommonSetupEvent event) {
EVENT_BUS.addListener(EventPriority.LOWEST, DrivePool.INSTANCE::onServerPostTick);
EVENT_BUS.addListener(EventPriority.HIGHEST, DrivePool.INSTANCE::serverStopEvent);
EVENT_BUS.addListener(EventPriority.LOWEST, DrivePool.INSTANCE::serverStartEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, DrivePool.INSTANCE::onWorldSave);
EVENT_BUS.addListener(EventPriority.HIGHEST, GlobalEventHandlerKt::onServerStopped);
EVENT_BUS.addListener(EventPriority.HIGHEST, GlobalEventHandlerKt::onServerStopping);
EVENT_BUS.addListener(EventPriority.HIGHEST, GlobalEventHandlerKt::onServerStarting);
EVENT_BUS.addListener(EventPriority.LOWEST, GlobalEventHandlerKt::onWorldTick);
EVENT_BUS.addListener(EventPriority.LOWEST, GlobalEventHandlerKt::onServerTick);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::onPlayerTick);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::isMobEffectApplicable);
EVENT_BUS.addListener(EventPriority.LOW, MatteryPlayerCapability.Companion::onHurtEvent);
EVENT_BUS.addGenericListener(Entity.class, EventPriority.NORMAL, MatteryPlayerCapability.Companion::onAttachCapabilityEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::onPlayerChangeDimensionEvent);
EVENT_BUS.addListener(EventPriority.LOWEST, MatteryPlayerCapability.Companion::onPlayerDeath);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::onPlayerCloneEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::onStartTracking);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryPlayerCapability.Companion::onStopTracking);
EVENT_BUS.addListener(EventPriority.NORMAL, ExplosionQueue.Companion::onWorldTick);
EVENT_BUS.addListener(EventPriority.NORMAL, AbstractWeaponItem.Companion::tick);
EVENT_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::tick);
EVENT_BUS.addListener(EventPriority.LOWEST, PortableCondensationDriveItem.Companion::onPickupEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidResearchManager.INSTANCE::reloadEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidResearchManager.INSTANCE::syncEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::reloadEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::onServerStarted);
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::onDataPackSync);
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::addCommands);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onServerStopping);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onLevelUnload);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onWatch);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::onForget);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryBlockEntity.Companion::playerDisconnected);
EVENT_BUS.addListener(EventPriority.LOWEST, MatteryBlockEntity.Companion::postLevelTick);
EVENT_BUS.addListener(EventPriority.LOWEST, KillAsAndroidTrigger.INSTANCE::onKill);
EVENT_BUS.addListener(EventPriority.NORMAL, EnderTeleporterFeature.Companion::onEntityDeath);
EVENT_BUS.addListener(EventPriority.HIGH, TritaniumArmorItem.Companion::onHurt);
EVENT_BUS.addListener(EventPriority.NORMAL, ExplosiveHammerItem.Companion::onLeftClickBlock);
MatteryPlayerNetworkChannel.INSTANCE.register();
MenuNetworkChannel.INSTANCE.register();
WeaponNetworkChannel.INSTANCE.register();
RegistryNetworkChannel.INSTANCE.register();
WorldNetworkChannel.INSTANCE.register();
GenericNetworkChannel.INSTANCE.register();
ITEM_STORAGE = StorageRegistry.register(ItemStackWrapper.class, ItemStackWrapper.EMPTY, new Decimal("3.125"));
if (ModList.get().isLoaded("mekanism")) {
EVENT_BUS.addGenericListener(BlockEntity.class, EventPriority.NORMAL, QIOKt::attachCapabilities);
}
if (ModList.get().isLoaded(CuriosApi.MODID)) {
EVENT_BUS.addListener(EventPriority.NORMAL, CuriosCompatKt::onCuriosSlotModifiersUpdated);
}
if (AdAstraCompatKt.isAdAstraLoaded()) {
EVENT_BUS.addListener(EventPriority.NORMAL, AdAstraCompatKt::onDamageEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, AdAstraCompatKt::onMatteryTick);
}
}
private void setupClient(final FMLClientSetupEvent event) {
EVENT_BUS.addListener(EventPriority.NORMAL, MatterManager.INSTANCE::tooltipEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, AbstractWeaponItem.Companion::playerRenderHook);
EVENT_BUS.addListener(EventPriority.NORMAL, AbstractWeaponItem.Companion::fovHook);
EVENT_BUS.addListener(EventPriority.NORMAL, AbstractWeaponItem.Companion::clickHook);
EVENT_BUS.addListener(EventPriority.NORMAL, AbstractWeaponItem.Companion::renderViewModel);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryGUI.INSTANCE::onScreenRender);
EVENT_BUS.addListener(EventPriority.LOWEST, MatteryGUI.INSTANCE::onOpenGUIEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, MatteryGUI.INSTANCE::onRenderGuiEvent);
EVENT_BUS.addListener(EventPriority.HIGH, MatteryGUI.INSTANCE::onLayerRenderEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, ShockwaveRenderer.INSTANCE::onRender);
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onMovementInputUpdate);
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onScreenOpen);
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onPostScreenInit);
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onMouseDragged);
EVENT_BUS.addListener(EventPriority.NORMAL, ClientEventHandlerKt::onMouseScrolled);
EVENT_BUS.addListener(EventPriority.LOWEST, ClientTickHandlerKt::onClientTick);
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientConnected);
EVENT_BUS.addListener(EventPriority.HIGHEST, ClientTickHandlerKt::onClientDisconnected);
EVENT_BUS.addListener(EventPriority.NORMAL, QuantumBatteryItem.Companion::clientDisconnect);
if (ModList.get().isLoaded("mekanism")) {
EVENT_BUS.addListener(EventPriority.NORMAL, TooltipsKt::tooltipEvent);
}
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping.INSTANCE::onRenderGuiEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidMenuKeyMapping.INSTANCE::onMouseClick);
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::onRenderGuiEvent);
EVENT_BUS.addListener(EventPriority.NORMAL, AndroidAbilityKeyMapping.INSTANCE::onRenderLevel);
EVENT_BUS.addListener(EventPriority.NORMAL, ExosuitModel::onPlayerRendered);
event.enqueueWork(GlobalEventHandlerKt::recordClientThread);
}
}

View File

@ -1,13 +1,11 @@
package ru.dbotthepony.mc.otm.capability; package ru.dbotthepony.mc.otm.capability;
import net.minecraft.core.Direction; import mekanism.api.energy.IStrictEnergyHandler;
import net.minecraft.resources.ResourceLocation; import net.minecraftforge.common.capabilities.CapabilityManager;
import net.neoforged.neoforge.capabilities.BlockCapability; import net.minecraftforge.common.capabilities.Capability;
import net.neoforged.neoforge.capabilities.ItemCapability; import net.minecraftforge.common.capabilities.CapabilityToken;
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.block.entity.cable.EnergyCableBlockEntity;
import ru.dbotthepony.mc.otm.capability.drive.IMatteryDrive; import ru.dbotthepony.mc.otm.capability.drive.IMatteryDrive;
import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage; import ru.dbotthepony.mc.otm.capability.energy.IMatteryEnergyStorage;
import ru.dbotthepony.mc.otm.capability.matter.IMatterStorage; import ru.dbotthepony.mc.otm.capability.matter.IMatterStorage;
@ -15,62 +13,64 @@ import ru.dbotthepony.mc.otm.capability.matter.IReplicationTaskProvider;
import ru.dbotthepony.mc.otm.capability.matter.IPatternStorage; import ru.dbotthepony.mc.otm.capability.matter.IPatternStorage;
import ru.dbotthepony.mc.otm.graph.matter.MatterNode; import ru.dbotthepony.mc.otm.graph.matter.MatterNode;
import ru.dbotthepony.mc.otm.graph.storage.StorageNode; import ru.dbotthepony.mc.otm.graph.storage.StorageNode;
import top.theillusivec4.curios.api.type.capability.ICurio;
import top.theillusivec4.curios.api.type.capability.ICuriosItemHandler;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
public class MatteryCapability { public class MatteryCapability {
@Nonnull @Nonnull
@NotNull @NotNull
public static final BlockCapability<IMatteryEnergyStorage, @Nullable Direction> BLOCK_ENERGY = BlockCapability.createSided(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "energy"), IMatteryEnergyStorage.class); public static final Capability<IMatteryEnergyStorage> ENERGY = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
public static final ItemCapability<IMatteryEnergyStorage, Void> ITEM_ENERGY = ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "energy"), IMatteryEnergyStorage.class); public static final Capability<MatteryPlayerCapability> MATTERY_PLAYER = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
public static final ItemCapability<IMatterStorage, Void> MATTER_ITEM = ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "matter"), IMatterStorage.class); public static final Capability<IMatterStorage> MATTER = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
public static final BlockCapability<IMatterStorage, @Nullable Direction> MATTER_BLOCK = BlockCapability.createSided(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "matter"), IMatterStorage.class); public static final Capability<MatterNode> MATTER_NODE = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
public static final BlockCapability<MatterNode, @Nullable Direction> MATTER_NODE = BlockCapability.createSided(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "matter_node"), MatterNode.class); public static final Capability<IPatternStorage> PATTERN = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
public static final ItemCapability<IPatternStorage, Void> PATTERN_ITEM = ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "pattern"), IPatternStorage.class); public static final Capability<IReplicationTaskProvider> TASK = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
public static final BlockCapability<IPatternStorage, @Nullable Direction> PATTERN_BLOCK = BlockCapability.createSided(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "pattern"), IPatternStorage.class); public static final Capability<IMatteryDrive> DRIVE = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
public static final BlockCapability<IReplicationTaskProvider, Void> REPLICATION_TASK = BlockCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "replication_task"), IReplicationTaskProvider.class); public static final Capability<StorageNode> STORAGE_NODE = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull @Nonnull
@NotNull @NotNull
// this weird cast is required because otherwise IMatteryDrive gets incompatible lower-bound due to Java raw generic type public static final Capability<IStrictEnergyHandler> MEKANISM_ENERGY = CapabilityManager.get(new CapabilityToken<>() {});
// and K2 compiler chokes and dies due to it
public static final ItemCapability<IMatteryDrive<?>, Void> CONDENSATION_DRIVE = (ItemCapability<IMatteryDrive<?>, Void>) (Object) ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "condensation_drive"), IMatteryDrive.class);
@Nonnull @Nonnull
@NotNull @NotNull
public static final BlockCapability<StorageNode, @Nullable Direction> STORAGE_NODE = BlockCapability.createSided(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "storage_node"), StorageNode.class); public static final Capability<ICuriosItemHandler> CURIOS_INVENTORY = CapabilityManager.get(new CapabilityToken<>() {});
// TODO: remove this
@Nonnull
@NotNull
public static final BlockCapability<EnergyCableBlockEntity.Node, Void> ENERGY_CABLE_NODE = BlockCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "energy_cable_node"), EnergyCableBlockEntity.Node.class);
@Nonnull @Nonnull
@NotNull @NotNull
public static final ItemCapability<IMatteryUpgrade, Void> UPGRADE = ItemCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "machine_upgrade"), IMatteryUpgrade.class); public static final Capability<ICurio> CURIOS_ITEM = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull public static void register(RegisterCapabilitiesEvent event) {
@NotNull event.register(IMatteryEnergyStorage.class);
public static final BlockCapability<IQuickStackContainer, Void> QUICK_STACK_CONTAINER = BlockCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "quick_stack_container"), IQuickStackContainer.class); event.register(MatteryPlayerCapability.class);
event.register(IMatterStorage.class);
event.register(MatterNode.class);
event.register(IPatternStorage.class);
event.register(IReplicationTaskProvider.class);
event.register(IMatteryDrive.class);
event.register(StorageNode.class);
}
} }

View File

@ -1,77 +0,0 @@
package ru.dbotthepony.mc.otm.client.animation;
import net.minecraft.client.animation.AnimationChannel;
import net.minecraft.client.animation.AnimationDefinition;
import net.minecraft.client.animation.Keyframe;
import net.minecraft.client.animation.KeyframeAnimations;
public class BreadMonsterAnimation {
public static final AnimationDefinition IDLE = AnimationDefinition.Builder.withLength(1.44F).looping()
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, -2.5F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(0.0F, 3.33F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.44F, KeyframeAnimations.degreeVec(0.0F, -2.5F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Ljaw", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.44F, KeyframeAnimations.degreeVec(2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("UJaw", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(-5.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.44F, KeyframeAnimations.degreeVec(-2.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 5.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(0.0F, -7.5F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.44F, KeyframeAnimations.degreeVec(0.0F, 5.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
public static final AnimationDefinition MOVE = AnimationDefinition.Builder.withLength(1.44F).looping()
.addAnimation("root", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(1.0F, 0.0F, 2.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0.0F, 5.0F, -1.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(-1.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.posVec(-2.0F, 0.0F, 2.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.84F, KeyframeAnimations.posVec(0.0F, 5.0F, -1.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.96F, KeyframeAnimations.posVec(1.0F, 0.0F, -1.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.44F, KeyframeAnimations.posVec(1.0F, 0.0F, 2.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(7.5283F, 4.9571F, 0.6543F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(12.5094F, 1.6524F, 0.2181F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.84F, KeyframeAnimations.degreeVec(7.5283F, -4.9571F, -0.6543F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.92F, KeyframeAnimations.degreeVec(15.0189F, -3.3047F, -0.4362F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.96F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Ljaw", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(25.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.32F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.84F, KeyframeAnimations.degreeVec(25.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.04F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("UJaw", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(-25.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.32F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.84F, KeyframeAnimations.degreeVec(-30.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(1.04F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("tail", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.degreeVec(-10.0374F, -4.9238F, 0.8704F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.72F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.84F, KeyframeAnimations.degreeVec(-12.5462F, 4.8812F, -1.0848F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.96F, KeyframeAnimations.degreeVec(0.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
}

View File

@ -1,155 +0,0 @@
package ru.dbotthepony.mc.otm.client.animation;
import net.minecraft.client.animation.AnimationChannel;
import net.minecraft.client.animation.AnimationDefinition;
import net.minecraft.client.animation.Keyframe;
import net.minecraft.client.animation.KeyframeAnimations;
public class LoaderAnimation {
public static final AnimationDefinition IDLE = AnimationDefinition.Builder.withLength(0.16F).looping()
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.08F, KeyframeAnimations.posVec(0F, -0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Head", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.08F, KeyframeAnimations.posVec(0F, -0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, -0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0.1F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, -0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
public static final AnimationDefinition MOVE = AnimationDefinition.Builder.withLength(0.48F).looping()
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Head", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.3F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 1F, 1F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 2F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, -2F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 2F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, -2F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 2F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(22.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowR", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-30F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-19.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-30F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.12F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.36F, KeyframeAnimations.posVec(0F, 0.2F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-6F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowL", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-16.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.24F, KeyframeAnimations.degreeVec(-25.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-16.5F, 0F, 0F), AnimationChannel.Interpolations.LINEAR)
))
.build();
public static final AnimationDefinition ATTACK = AnimationDefinition.Builder.withLength(0.48F).looping()
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(19.27F, 2.7545F, -11.804F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.degreeVec(25.4138F, -37.1586F, -16.0129F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, -1.1F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(-4.0F, -1.0F, 6.9F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(-1.0F, 0.0F, 0.9F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowR", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-15.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.degreeVec(-22.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.32F, KeyframeAnimations.degreeVec(-75.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-20.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(2.0031F, 14.8687F, 7.7614F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.32F, KeyframeAnimations.degreeVec(-105.5693F, -6.858F, 48.036F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-4.4119F, -9.6204F, 22.9232F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightArm", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(0.0F, 0.0F, 1.4F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(3.0F, 3.0F, -9.6F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(0.0F, 2.0F, -2.6F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("ElbowL", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-32.5F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.2F, KeyframeAnimations.degreeVec(-60.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(-25.0F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Head", new AnimationChannel(AnimationChannel.Targets.POSITION,
new Keyframe(0.0F, KeyframeAnimations.posVec(-0.6F, 0.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.posVec(3.0F, 0.0F, -2.6F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.posVec(1.0F, 0.0F, -1.6F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("Body", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(0.0F, 7.5F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.16F, KeyframeAnimations.degreeVec(0.0F, -35.0F, 0.0F), AnimationChannel.Interpolations.LINEAR),
new Keyframe(0.48F, KeyframeAnimations.degreeVec(0.0F, -12.5F, 0.0F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("LeftLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(-4.9953F, -0.2178F, -2.4905F), AnimationChannel.Interpolations.LINEAR)
))
.addAnimation("RightLeg", new AnimationChannel(AnimationChannel.Targets.ROTATION,
new Keyframe(0.0F, KeyframeAnimations.degreeVec(7.4929F, -0.3262F, 2.4786F), AnimationChannel.Interpolations.LINEAR)
))
.build();
}

View File

@ -18,9 +18,9 @@ import net.minecraft.client.renderer.entity.RenderLayerParent;
import net.minecraft.client.renderer.entity.layers.RenderLayer; import net.minecraft.client.renderer.entity.layers.RenderLayer;
import net.minecraft.client.renderer.entity.player.PlayerRenderer; import net.minecraft.client.renderer.entity.player.PlayerRenderer;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.client.event.RenderPlayerEvent; import net.minecraftforge.client.event.RenderPlayerEvent;
import ru.dbotthepony.mc.otm.OverdriveThatMatters; import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.player.IMatteryPlayer; import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.util.Set; import java.util.Set;
@ -31,8 +31,7 @@ public final class ExosuitModel {
public static final HumanoidModel<AbstractClientPlayer> modelNormal; public static final HumanoidModel<AbstractClientPlayer> modelNormal;
public static final HumanoidModel<AbstractClientPlayer> modelGlow; public static final HumanoidModel<AbstractClientPlayer> modelGlow;
public static final ResourceLocation texture = ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "textures/models/armor/exosuit.png"); public static final ResourceLocation texture = new ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/models/armor/exosuit.png");
public static final ResourceLocation textureColor = ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "textures/models/armor/exosuit_color.png");
static { static {
MeshDefinition meshdefinition = new MeshDefinition(); MeshDefinition meshdefinition = new MeshDefinition();
@ -103,6 +102,7 @@ public final class ExosuitModel {
super(p_117346_); super(p_117346_);
} }
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Override @Override
public void render( public void render(
@Nonnull PoseStack poseStack, @Nonnull PoseStack poseStack,
@ -116,12 +116,13 @@ public final class ExosuitModel {
float p_117357_, float p_117357_,
float p_117358_ float p_117358_
) { ) {
if (player.isInvisible()) var cap = player.getCapability(MatteryCapability.MATTERY_PLAYER);
if (!cap.isPresent()) {
return; return;
}
var mattery = ((IMatteryPlayer) player).getOtmPlayer(); if (cap.resolve().get().getHasExoPack() && cap.resolve().get().getDisplayExoPack()) {
if (mattery.getHasExopack() && mattery.isExopackVisible()) {
var model = getParentModel(); var model = getParentModel();
model.copyPropertiesTo(modelNormal); model.copyPropertiesTo(modelNormal);
model.copyPropertiesTo(modelGlow); model.copyPropertiesTo(modelGlow);
@ -134,42 +135,18 @@ public final class ExosuitModel {
packedLight, packedLight,
overlayCoords, overlayCoords,
// rgba // rgba
-1 1f, 1f, 1f, 1f
); );
var color = mattery.getExopackColor();
if (color != null) {
modelNormal.renderToBuffer(
poseStack,
bufferSource.getBuffer(RenderType.entityCutoutNoCull(textureColor)),
packedLight,
overlayCoords,
color.toBGRA()
);
}
if (mattery.getExopackGlows()) {
modelGlow.renderToBuffer( modelGlow.renderToBuffer(
poseStack, poseStack,
bufferSource.getBuffer(RenderType.entityTranslucentEmissive(texture)), bufferSource.getBuffer(RenderType.entityTranslucentEmissive(texture)),
packedLight, packedLight,
overlayCoords, overlayCoords,
-1
);
} else {
modelGlow.renderToBuffer(
poseStack,
bufferSource.getBuffer(RenderType.entityCutoutNoCull(texture)),
packedLight,
overlayCoords,
// rgba // rgba
-1 1f, 1f, 1f, 1f
); );
} }
mattery.makeSmokeParticles(poseStack, model);
}
} }
} }

View File

@ -4,7 +4,8 @@ import net.minecraft.client.model.HumanoidModel;
import net.minecraft.client.model.geom.ModelLayerLocation; import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*; import net.minecraft.client.model.geom.builders.*;
import net.neoforged.neoforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.event.EntityRenderersEvent;
import ru.dbotthepony.mc.otm.OverdriveThatMatters; import ru.dbotthepony.mc.otm.OverdriveThatMatters;
import ru.dbotthepony.mc.otm.registry.MNames; import ru.dbotthepony.mc.otm.registry.MNames;

View File

@ -11,7 +11,8 @@ import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelLayers; import net.minecraft.client.model.geom.ModelLayers;
import net.minecraft.client.model.geom.PartPose; import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*; import net.minecraft.client.model.geom.builders.*;
import net.neoforged.neoforge.client.event.EntityRenderersEvent; import net.minecraftforge.client.ForgeHooksClient;
import net.minecraftforge.client.event.EntityRenderersEvent;
import javax.annotation.ParametersAreNonnullByDefault; import javax.annotation.ParametersAreNonnullByDefault;

View File

@ -1,73 +0,0 @@
package ru.dbotthepony.mc.otm.client.model.entity;
import net.minecraft.client.model.HierarchicalModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeDeformation;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.LayerDefinition;
import net.minecraft.client.model.geom.builders.MeshDefinition;
import net.minecraft.client.model.geom.builders.PartDefinition;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import org.jetbrains.annotations.NotNull;
import ru.dbotthepony.mc.otm.client.animation.BreadMonsterAnimation;
import ru.dbotthepony.mc.otm.entity.BreadMonster;
import ru.dbotthepony.mc.otm.registry.MNames;
import static ru.dbotthepony.mc.otm.OverdriveThatMatters.loc;
public class BreadMonsterModel {
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(loc(MNames.BREAD_MONSTER), "main");
private static HierarchicalModel<BreadMonster> model;
private static LayerDefinition def;
public static HierarchicalModel<BreadMonster> getModel() {
if (model == null) {
return model = new BreadMonsterHierarchicalModel<>(def.bakeRoot());
}
return model;
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F));
PartDefinition Body = root.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(0, 0).addBox(-4.0F, -3.0F, -5.0F, 8.0F, 6.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -3.0F, 0.0F));
PartDefinition Ljaw = Body.addOrReplaceChild("Ljaw", CubeListBuilder.create().texOffs(26, 24).addBox(-4.0F, -2.0F, -4.0F, 8.0F, 3.0F, 4.0F, new CubeDeformation(0.1F)), PartPose.offset(0.0F, 2.0F, -3.0F));
PartDefinition UJaw = Body.addOrReplaceChild("UJaw", CubeListBuilder.create().texOffs(0, 24).addBox(-4.0F, -2.0F, -4.0F, 8.0F, 3.0F, 5.0F, new CubeDeformation(0.1F)), PartPose.offset(0.0F, -1.0F, -3.0F));
PartDefinition tail = Body.addOrReplaceChild("tail", CubeListBuilder.create().texOffs(0, 12).addBox(-4.0F, -3.0F, -0.1F, 8.0F, 6.0F, 6.0F, new CubeDeformation(-0.1F)), PartPose.offset(0.0F, 0.0F, 1.0F));
model = null;
return def = LayerDefinition.create(meshdefinition, 64, 32);
}
private static class BreadMonsterHierarchicalModel<T extends BreadMonster> extends HierarchicalModel<T> {
private final ModelPart root;
public BreadMonsterHierarchicalModel(ModelPart root) {
this.root = root.getChild("root");
}
@Override
public void setupAnim(@NotNull T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
this.root().getAllParts().forEach(ModelPart::resetPose);
// this.applyStatic(BreadMonsterAnimation.IDLE);
this.animate(entity.getIdleState(), BreadMonsterAnimation.IDLE, ageInTicks, 1.0F);
this.animateWalk(BreadMonsterAnimation.MOVE, limbSwing, limbSwingAmount, 1.0F, 2.5F);
}
@Override
public @NotNull ModelPart root() {
return this.root;
}
}
public static void register(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(LAYER_LOCATION, BreadMonsterModel::createBodyLayer);
}
}

View File

@ -1,100 +0,0 @@
package ru.dbotthepony.mc.otm.client.model.entity;
import net.minecraft.client.model.HierarchicalModel;
import net.minecraft.client.model.geom.ModelLayerLocation;
import net.minecraft.client.model.geom.ModelPart;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.*;
import net.neoforged.neoforge.client.event.EntityRenderersEvent;
import org.jetbrains.annotations.NotNull;
import ru.dbotthepony.mc.otm.client.animation.LoaderAnimation;
import ru.dbotthepony.mc.otm.entity.Loader;
import ru.dbotthepony.mc.otm.registry.MNames;
import static ru.dbotthepony.mc.otm.OverdriveThatMatters.loc;
public class LoaderModel {
public static final ModelLayerLocation LAYER_LOCATION = new ModelLayerLocation(loc(MNames.LOADER), "main");
private static HierarchicalModel<Loader> model;
private static LayerDefinition def;
public static HierarchicalModel<Loader> getModel() {
if (def == null) {
def = createBodyLayer(); // Ensure def is created before using it
}
if (model == null) {
return model = new LoaderHierarchicalModel<>(def.bakeRoot());
}
return model;
}
public static LayerDefinition createBodyLayer() {
MeshDefinition meshdefinition = new MeshDefinition();
PartDefinition partdefinition = meshdefinition.getRoot();
PartDefinition root = partdefinition.addOrReplaceChild("root", CubeListBuilder.create(), PartPose.offset(0.0F, 24.0F, 0.0F));
PartDefinition Head = root.addOrReplaceChild("Head", CubeListBuilder.create().texOffs(48, 23).addBox(-3.0F, -1.0F, -2.0F, 6.0F, 3.0F, 3.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, -32.0F, -5.0F));
PartDefinition Body = root.addOrReplaceChild("Body", CubeListBuilder.create().texOffs(0, 0).addBox(-10.0F, -16.0F, -5.0F, 20.0F, 10.0F, 13.0F, new CubeDeformation(0.0F))
.texOffs(0, 50).addBox(-3.0F, -3.0F, -4.0F, 6.0F, 5.0F, 8.0F, new CubeDeformation(0.0F))
.texOffs(112, 52).addBox(10.0F, -13.0F, 0.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(96, 52).addBox(-12.0F, -13.0F, -1.0F, 2.0F, 6.0F, 6.0F, new CubeDeformation(0.0F))
.texOffs(53, 0).addBox(-5.0F, -1.0F, 4.0F, 10.0F, 4.0F, 4.0F, new CubeDeformation(0.0F)), PartPose.offset(0.0F, -26.0F, -1.0F));
PartDefinition antenna_r1 = Body.addOrReplaceChild("antenna_r1", CubeListBuilder.create().texOffs(76, 6).addBox(0.0F, -7.0F, -1.0F, 0.0F, 14.0F, 2.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(8.0F, -22.0F, 8.0F, -0.2618F, 0.0F, 0.0F));
PartDefinition waist_r1 = Body.addOrReplaceChild("waist_r1", CubeListBuilder.create().texOffs(28, 50).addBox(-2.0F, -5.0F, -4.0F, 4.0F, 7.0F, 7.0F, new CubeDeformation(0.0F)), PartPose.offsetAndRotation(0.0F, -3.0F, 2.0F, -0.2618F, 0.0F, 0.0F));
PartDefinition LeftLeg = root.addOrReplaceChild("LeftLeg", CubeListBuilder.create().texOffs(106, 24).addBox(0.0F, 10.0F, -2.0F, 4.0F, 16.0F, 7.0F, new CubeDeformation(0.0F))
.texOffs(66, 46).addBox(-1.0F, -2.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(4.0F, -26.0F, -1.0F));
PartDefinition RightLeg = root.addOrReplaceChild("RightLeg", CubeListBuilder.create().texOffs(84, 24).addBox(-4.0F, 10.0F, -2.0F, 4.0F, 16.0F, 7.0F, new CubeDeformation(0.0F))
.texOffs(48, 34).addBox(-5.0F, -2.0F, -3.0F, 6.0F, 12.0F, 6.0F, new CubeDeformation(0.0F)), PartPose.offset(-4.0F, -26.0F, -1.0F));
PartDefinition LeftArm = root.addOrReplaceChild("LeftArm", CubeListBuilder.create().texOffs(104, 0).addBox(-1.0F, -7.0F, -4.0F, 4.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(13.0F, -36.0F, 2.0F));
PartDefinition ElbowL = LeftArm.addOrReplaceChild("ElbowL", CubeListBuilder.create().texOffs(24, 23).addBox(-2.0F, -0.2F, -2.0F, 4.0F, 19.0F, 8.0F, new CubeDeformation(-0.1F)), PartPose.offset(1.0F, 9.0F, -1.0F));
PartDefinition RightArm = root.addOrReplaceChild("RightArm", CubeListBuilder.create().texOffs(80, 0).addBox(-3.0F, -7.0F, -4.0F, 4.0F, 16.0F, 8.0F, new CubeDeformation(0.0F)), PartPose.offset(-13.0F, -36.0F, 1.0F));
PartDefinition ElbowR = RightArm.addOrReplaceChild("ElbowR", CubeListBuilder.create().texOffs(0, 23).addBox(-2.0F, -0.2F, -2.0F, 4.0F, 19.0F, 8.0F, new CubeDeformation(-0.1F)), PartPose.offset(-1.0F, 9.0F, -1.0F));
model = null;
return def = LayerDefinition.create(meshdefinition, 128, 64);
}
private static class LoaderHierarchicalModel<T extends Loader> extends HierarchicalModel<T> {
private final ModelPart root;
public LoaderHierarchicalModel(ModelPart root) {
this.root = root.getChild("root");
}
@Override
public void setupAnim(@NotNull T entity, float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch) {
this.root().getAllParts().forEach(ModelPart::resetPose);
this.root.getChild("Head").yRot = netHeadYaw * ((float) Math.PI / 180F);
this.root.getChild("Head").xRot = headPitch * ((float) Math.PI / 180F);
if (entity.getAttackAnimationTick() > 0) {
this.animate(entity.getIdleState(), LoaderAnimation.ATTACK, ageInTicks, 1.0F);
}
this.animateWalk(LoaderAnimation.MOVE, limbSwing, limbSwingAmount, 0.8F, 2.5F);
this.animate(entity.getIdleState(), LoaderAnimation.IDLE, ageInTicks, 1.0F);
}
public ModelPart getHead() {
return this.root.getChild("Head");
}
@Override
public @NotNull ModelPart root() {
return this.root;
}
}
public static void register(EntityRenderersEvent.RegisterLayerDefinitions event) {
event.registerLayerDefinition(LAYER_LOCATION, LoaderModel::createBodyLayer);
}
}

View File

@ -0,0 +1,191 @@
package ru.dbotthepony.mc.otm.client.screen.panels;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import ru.dbotthepony.mc.otm.client.screen.MatteryScreen;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class FlexGridPanel<S extends Screen> extends EditablePanel<S> {
public enum FlexAlign {
TOP_LEFT,
TOP_CENTER,
TOP_RIGHT,
MIDDLE_LEFT,
MIDDLE_CENTER,
MIDDLE_RIGHT,
BOTTOM_LEFT,
BOTTOM_CENTER,
BOTTOM_RIGHT
}
protected FlexAlign align = FlexAlign.MIDDLE_CENTER;
public int panels_per_row = 1;
public FlexGridPanel(@Nonnull S screen, @Nullable EditablePanel<?> parent, float x, float y, float width, float height) {
super(screen, parent, x, y, width, height);
}
public FlexGridPanel(@Nonnull S screen, @Nullable EditablePanel<?> parent, float x, float y) {
super(screen, parent, x, y);
}
public FlexGridPanel(@Nonnull S screen, @Nullable EditablePanel<?> parent) {
super(screen, parent);
}
public FlexAlign getAlign() {
return align;
}
public FlexGridPanel<S> setAlign(FlexAlign align) {
this.align = align;
return this;
}
@Override
public void performLayout() {
if (align == FlexAlign.MIDDLE_CENTER) {
// список потомков
var children = getUndockedVisibleChildren();
if (children.size() == 0) {
return;
}
// хранит общую ширину всех потомков в ряд
// а так же ограничитель ширины ряда после
// определения количества рядов
float desired_width = 0;
// минимально допустимая ширина одного ряда
float min_width = getWidth();
// "финальная" ширина этой панели
float this_width = getWidth() - getDockPadding().left() - getDockPadding().right();
if (this_width <= 0) {
return;
}
for (var child : children) {
min_width = Math.min(min_width, child.getWidth() + child.getDockMargin().left() + child.getDockMargin().right());
desired_width += child.getWidth() + child.getDockMargin().left() + child.getDockMargin().right();
}
int rows = 1;
// если общая ширина больше чем ширина панели, делим пополам пока не найдем нужную ширину и количество рядов
while (desired_width > this_width && desired_width > min_width) {
desired_width /= 2;
rows++;
}
if (desired_width < min_width) {
desired_width = min_width;
}
int index;
// определение высоты всех рядов вместе
float total_height = 0;
// утютю никаких goto
// зато код чище некуда!
while (desired_width <= this_width) {
index = 0;
total_height = 0;
panels_per_row = 0;
boolean calculate_row_width = true;
for (int row = 0; row < rows; row++) {
float max_height = 0;
float total_width = 0;
for (int i = index; i < children.size(); i++) {
var child = children.get(i);
var gain_width = child.getWidth() + child.getDockMargin().left() + child.getDockMargin().right();
index = i;
if (gain_width + total_width > desired_width) {
if (calculate_row_width) {
panels_per_row = i + 1;
calculate_row_width = false;
}
break;
}
max_height = Math.max(max_height, child.getHeight() + child.getDockMargin().top() + child.getDockMargin().bottom());
total_width += gain_width;
}
total_height += max_height;
}
if (index + 1 < children.size() && desired_width != this_width) {
// не все панели уместились. ну чтож
desired_width = Math.min(desired_width + min_width, this_width);
} else {
break;
}
}
index = 0;
// ширину на середину для позиционирования по центру
this_width /= 2;
// определение точки по середине по высоте
float h_middle = (getHeight() - getDockPadding().bottom() - getDockPadding().top() - total_height) / 2;
// OverdriveThatMatters.LOGGER.info("Общая высота {}, рядов {}, середина {}", total_height, rows, h_middle);
for (int row = 0; row < rows; row++) {
float max_height = 0;
float total_width = 0;
int until = index;
for (int i = index; i < children.size(); i++) {
var child = children.get(i);
var gain_width = child.getWidth() + child.getDockMargin().left() + child.getDockMargin().right();
until = i;
if (gain_width + total_width > desired_width) {
break;
}
max_height = Math.max(max_height, child.getHeight() + child.getDockMargin().top() + child.getDockMargin().bottom());
total_width += gain_width;
}
total_width /= 2;
max_height /= 2;
// OverdriveThatMatters.LOGGER.info("Ряд {}, общая ширина {}, максимальная высота {}, позиция {}, c {} до {}", row, total_width * 2, max_height * 2, h_middle, index, until);
float accumulate_width = 0;
for (int i = index; i <= until; i++) {
var child = children.get(i);
child.setPos((int) (this_width - total_width + accumulate_width + child.getDockMargin().left()), (int) (h_middle + max_height - child.getHeight() / 2));
accumulate_width += child.getWidth() + child.getDockMargin().left() + child.getDockMargin().right();
}
h_middle += max_height * 2;
index = until;
}
}
super.performLayout();
}
}

View File

@ -1,25 +0,0 @@
package ru.dbotthepony.mc.otm.mixin;
import net.minecraft.world.level.block.entity.BlockEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import ru.dbotthepony.mc.otm.multiblock.GlobalBlockEntityRemovalListener;
// because i know
// someone
// somewhere
// will try to break the system
// either on purpose or accidentally because of other mod
@Mixin(BlockEntity.class)
public abstract class BlockEntityMixin {
@Inject(
at = @At("TAIL"),
method = "setRemoved()V",
remap = false
)
public void setRemovedListener(CallbackInfo ci) {
GlobalBlockEntityRemovalListener.Companion.onBlockEntityInvalidated((BlockEntity) (Object) this);
}
}

View File

@ -1,36 +0,0 @@
package ru.dbotthepony.mc.otm.mixin;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockState;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import ru.dbotthepony.mc.otm.item.tool.RedstoneInteractorItem;
@Mixin(BlockBehaviour.BlockStateBase.class)
public abstract class BlockStateBaseMixin {
@Shadow
protected abstract BlockState asState();
@Inject(
method = "getSignal(Lnet/minecraft/world/level/BlockGetter;Lnet/minecraft/core/BlockPos;Lnet/minecraft/core/Direction;)I",
at = @At("HEAD"),
cancellable = true,
remap = false
)
public void getSignal(BlockGetter p_60747_, BlockPos p_60748_, Direction p_60749_, CallbackInfoReturnable<Integer> info) {
if (p_60747_ instanceof Level level) {
int hookResult = RedstoneInteractorItem.Companion.getSignalHook(level, this.asState(), p_60748_, p_60749_);
if (hookResult != -1) {
info.setReturnValue(hookResult);
}
}
}
}

View File

@ -1,16 +0,0 @@
package ru.dbotthepony.mc.otm.mixin;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.entity.DispenserBlockEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import ru.dbotthepony.mc.otm.compat.vanilla.MatteryChestMenu;
@Mixin(DispenserBlockEntity.class)
public abstract class DispenserBlockEntityMixin {
@Overwrite(remap = false)
public AbstractContainerMenu createMenu(int p_59312_, Inventory p_59313_) {
return MatteryChestMenu.c3x3(p_59312_, p_59313_, (DispenserBlockEntity) (Object) this);
}
}

View File

@ -0,0 +1,24 @@
package ru.dbotthepony.mc.otm.mixin;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.enchantment.EnchantmentHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import ru.dbotthepony.mc.otm.item.weapon.EnergySwordItem;
@Mixin(EnchantmentHelper.class)
public class EnchantmentHelperMixin {
@Inject(
method = "getSweepingDamageRatio(Lnet/minecraft/world/entity/LivingEntity;)F",
at = @At("HEAD"),
cancellable = true)
private static void getSweepingDamageRatio(LivingEntity p_44822_, CallbackInfoReturnable<Float> info) {
var result = EnergySwordItem.getSweepingDamageRatioHook(p_44822_);
if (result != null) {
info.setReturnValue(result);
}
}
}

View File

@ -1,25 +0,0 @@
package ru.dbotthepony.mc.otm.mixin;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiGraphics;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import static ru.dbotthepony.mc.otm.client.render.RenderHelperKt.popScissorRect;
import static ru.dbotthepony.mc.otm.client.render.RenderHelperKt.pushScissorRect;
// because scissor stack fucking sucks.
// mostly because it is not a stack at all.
@Mixin(GuiGraphics.class)
public abstract class GuiGraphicsMixin {
@Overwrite(remap = false)
public void enableScissor(int x0, int y0, int x1, int y1) {
double scale = Minecraft.getInstance().getWindow().getGuiScale();
pushScissorRect((int) (scale * x0), (int) (scale * y0), (int) (scale * (x1 - x0)), (int) (scale * (y1 - y0)));
}
@Overwrite(remap = false)
public void disableScissor() {
popScissorRect();
}
}

View File

@ -1,16 +0,0 @@
package ru.dbotthepony.mc.otm.mixin;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.AbstractContainerMenu;
import net.minecraft.world.level.block.entity.HopperBlockEntity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import ru.dbotthepony.mc.otm.compat.vanilla.MatteryChestMenu;
@Mixin(HopperBlockEntity.class)
public abstract class HopperBlockEntityMixin {
@Overwrite(remap = false)
public AbstractContainerMenu createMenu(int p_59312_, Inventory p_59313_) {
return MatteryChestMenu.hopper(p_59312_, p_59313_, (HopperBlockEntity) (Object) this);
}
}

Some files were not shown because too many files have changed in this diff Show More