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
shapegen_output.java
/runs
/.kotlin

View File

@ -1,21 +1,22 @@
# 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
* [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
* [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
* Better Random
### Mods with special compatibility code
* [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)
* [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
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:

View File

@ -1,30 +1,35 @@
import groovy.lang.Closure
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.util.Date
import java.text.SimpleDateFormat
import it.unimi.dsi.fastutil.io.FastByteArrayOutputStream
import org.gradle.kotlin.dsl.accessors.runtime.addDependencyTo
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.util.UUID
val mod_version: String by project
val mc_version: String by project
val parchment_version: String by project
val forge_version: String by project
val mod_id: String by project
val handle_deps: String by project
val use_commit_hash_in_version: String by project
val handleDeps = handle_deps.toBoolean()
val caffeine_cache_version: String by project
plugins {
java
kotlin
idea
`maven-publish`
id("net.neoforged.gradle.userdev")
id("net.neoforged.gradle.mixin")
id("net.minecraftforge.gradle")
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 publishVersion: String get() {
@ -51,11 +56,18 @@ data class GitInfo(val version: String, val tag: String, val buildNumber: String
}
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
group = "ru.dbotthepony"
@ -64,6 +76,7 @@ fun getCommitVersion(): GitInfo? {
try {
val versionStream = FastByteArrayOutputStream()
val tagStream = FastByteArrayOutputStream()
val countStream = FastByteArrayOutputStream()
val gotVersion = exec {
commandLine("git", "rev-parse", "--short", "HEAD")
@ -71,20 +84,27 @@ fun getCommitVersion(): GitInfo? {
standardOutput = versionStream
}.exitValue == 0
val gotCount = exec {
commandLine("git", "rev-list", "--count", "HEAD")
workingDir(".")
standardOutput = countStream
}.exitValue == 0
val gotTag = exec {
commandLine("git", "tag", "--points-at", "HEAD")
workingDir(".")
standardOutput = tagStream
}.exitValue == 0
if (!gotVersion || !gotTag) {
if (!gotVersion || !gotCount || !gotTag) {
return null
}
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 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) {
println("Error getting git version")
println(err)
@ -93,13 +113,13 @@ fun getCommitVersion(): GitInfo? {
return null
}
java.toolchain.languageVersion.set(JavaLanguageVersion.of(21))
java.toolchain.languageVersion.set(JavaLanguageVersion.of(17))
println("Targeting Java ${java.toolchain.languageVersion.get()}")
tasks.withType(KotlinCompile::class.java) {
compilerOptions {
kotlinOptions {
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 {
create("data") {
compileClasspath += sourceSets["main"].output
compileClasspath += sourceSets["main"].compileClasspath
runtimeClasspath += sourceSets["main"].output
runtimeClasspath += sourceSets["main"].runtimeClasspath
}
this["main"].resources {
@ -123,119 +141,101 @@ sourceSets {
tasks.test {
useJUnitPlatform()
maxHeapSize = "4G"
}
configurations {
create("embeddedLibs")
}
jarJar.enable()
dependencies {
val jupiter_version: String by project
val kotlin_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 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}")
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) })
jarJar(implementation("ru.dbotthepony.kommons:kommons-gson:[$kommons_version,)") { setTransitive(false) })
jarJar(implementation("ru.dbotthepony.kommons:kommons-guava:[$kommons_version,)") { setTransitive(false) })
val excludeKGroup = closureOf<Any> {
(this as ExternalModuleDependency).exclude(group = "org.jetbrains", module = "annotations")
} 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")
annotationProcessor("org.spongepowered:mixin:${mixin_version}:processor")
if (handleDeps) {
val jei_version: String by project
val mekanism_version: String by project
val cosmetic_armor_reworked_id: String by project
val jade_id: String by project
val configured_id: String by project
val curios_version: String by project
val jei_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 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}")
implementation("curse.maven:cosmetic-armor-reworked-237307:$cosmetic_armor_reworked_id")
compileOnly(fg.deobf("top.theillusivec4.curios:curios-forge:${curios_version}+${curios_mc_version}"))
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("mezz.jei:jei-${jei_mc_version}-neoforge-api:${jei_version}")
runtimeOnly("mezz.jei:jei-${jei_mc_version}-neoforge:${jei_version}")
compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-common-api:${jei_version}"))
compileOnly(fg.deobf("mezz.jei:jei-${jei_mc_version}-forge-api:${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}")
//runtimeOnly("curse.maven:configured-457570:${configured_id}")
compileOnly(fg.deobf("curse.maven:ad-astra-635042:${ad_astra_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}")
compileOnly("curse.maven:resourceful-config-714059:${resourceful_config_id}")
compileOnly("curse.maven:botarium-704113:${botarium_id}")
compileOnly("curse.maven:ad-astra-635042:${ad_astra_id}")
runtimeOnly("curse.maven:worldedit-225608:${worldedit_id}")
// runtimeOnly(fg.deobf("curse.maven:worldedit-225608:${worldedit_fileid}"))
// runtimeOnly(fg.deobf("at.ridgo8.moreoverlays:MoreOverlays-updated:${more_overlays_version}"))
runtimeOnly("me.shedaniel.cloth:cloth-config-neoforge:${cloth_config_version}")
implementation("io.wispforest:condensed_creative-neoforge:${condensed_creative_version}")
compileOnly(fg.deobf("mekanism:Mekanism:${mekanism_version}:all"))
compileOnly("curse.maven:item-borders-513769:${item_borders_id}")
// implementation("curse.maven:item-borders-513769:${item_borders_id}")
// runtimeOnly("curse.maven:iceberg-520110:${iceberg_id}")
// runtimeOnly("curse.maven:prism-lib-638111:${prism_lib_id}")
// runtimeOnly("curse.maven:worldedit-225608:${worldedit_fileid}")
// 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")
// runtimeOnly(fg.deobf("curse.maven:cyclops-core-232758:4392602"))
// runtimeOnly(fg.deobf("curse.maven:integrated-dynamics-236307:4391535"))
// runtimeOnly(fg.deobf("curse.maven:integrated-crafting-287357:4391487"))
// runtimeOnly(fg.deobf("curse.maven:integrated-terminals-295910:4400924"))
// runtimeOnly(fg.deobf("curse.maven:common-capabilities-247007:4391468"))
// runtimeOnly(fg.deobf("curse.maven:integrated-tunnels-251389:4344632"))
}
}
configurations {
getByName("dataImplementation").extendsFrom(getByName("implementation"))
getByName("library").resolutionStrategy.cacheChangingModulesFor(10, "minutes")
}
minecraft {
accessTransformers {
files("src/main/resources/META-INF/accesstransformer.cfg")
val use_parchment: String by project
if (use_parchment.toBoolean()) {
mappings("parchment", parchment_version)
} else {
mappings("official", mc_version)
}
accessTransformer(file("src/main/resources/META-INF/accesstransformer.cfg"))
runs {
configureEach {
// "SCAN": For mods scan.
// "REGISTRIES": For firing of registry events.
// "REGISTRYDUMP": For getting the contents of all registries.
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,)")
create("client") {
mods {
create(mod_id) {
source(sourceSets["main"])
}
}
}
getByName("client") {
val usernameStream = FastByteArrayOutputStream()
val gotUsername = exec {
@ -248,32 +248,63 @@ minecraft {
val originalUsername = usernameStream.array.copyOfRange(0, usernameStream.length).toString(Charsets.UTF_8).trim()
if (originalUsername.isNotEmpty()) {
programArguments.addAll("--username", originalUsername)
args("--username", originalUsername)
} else {
programArguments.addAll("--username", "Dev_${System.getProperty("user.name")}")
args("--username", "Dev_${System.getProperty("user.name")}")
}
} else {
programArguments.addAll("--username", "Dev_${System.getProperty("user.name")}")
args("--username", "Dev_${System.getProperty("user.name")}")
}
}
getByName("server") {
programArguments.addAll("nogui")
create("server") {
mods {
create(mod_id) {
source(sourceSets["main"])
}
}
args("nogui")
}
getByName("data") {
programArguments.addAll("--mod", mod_id, "--all", "--output", file("src/data/resources/").absolutePath, "--existing", file("src/main/resources/").absolutePath)
create("data") {
args("--mod", mod_id, "--all", "--output", file("src/data/resources/"), "--existing", file("src/main/resources/"))
modSources(sourceSets["main"], sourceSets["data"])
mods {
create(mod_id) {
sources(sourceSets["main"], sourceSets["data"])
}
}
}
}
}
mixin {
add(sourceSets.main.get(), "$mod_id.refmap.json")
config("$mod_id.mixins.json")
config("$mod_id.ironchest.mixins.json")
config("$mod_id.ironshulkerbox.mixins.json")
// config("$mod_id.ad_astra.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 {
@ -287,20 +318,9 @@ repositories {
content {
includeGroup("yalter.mousetweaks")
includeGroup("mekanism")
includeGroup("lain.mods.cos")
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 {
name = "Jared's Maven"
url = uri("https://maven.blamejared.com/")
@ -325,37 +353,13 @@ repositories {
}
maven {
url = uri("https://maven.octo-studios.com/releases")
url = uri("https://maven.theillusivec4.top/")
content {
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()
}
@ -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 {
from(configurations["library"].map { if (it.isDirectory) it else zipTree(it) })
finalizedBy("reobfJar")
attachManifest()
archiveClassifier.set("slim")
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 {
create("sourceJar", org.gradle.jvm.tasks.Jar::class.java) {
archiveClassifier.set("sources")
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")) {
@ -418,6 +411,7 @@ if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword") &&
// from(components["java"])
artifact(tasks["jar"])
artifact(tasks["sourceJar"])
artifact(tasks["deobfJar"])
version = gitVersion.publishVersion
@ -447,9 +441,20 @@ if (project.hasProperty("mavenUser") && project.hasProperty("mavenPassword") &&
}
}
idea {
module {
isDownloadSources = true
isDownloadJavadoc = true
// 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
// publish.dependsOn("reobfJar")
/*
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', [
'convert',
'-compose', 'Multiply',
'-size', `${width}x${height}`,
'(',
`${root_main}${texA}.png`,
`xc:rgb(${rgbA[0]}, ${rgbA[1]}, ${rgbA[2]})`,
'-compose', 'Multiply',
'-composite',
')',
'(',
`${root_main}${texB}.png`,
`xc:rgb(${rgbB[0]}, ${rgbB[1]}, ${rgbB[2]})`,
'-channel', 'rgb',
'-compose', 'Multiply',
'-composite',
')',
'-channel', 'rgba',
'-compose', 'Over',
'-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
mod_id=overdrive_that_matters
mod_version=1.5
mod_version=1.3
use_commit_hash_in_version=true
mc_version=1.21.1
jei_mc_version=1.21.1
curios_mc_version=1.21
mc_version=1.20
use_parchment=false
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_version=21.1.21
forge_gradle_version=[6.0,6.2)
forge_version=46.0.10
mixingradle_version=0.7.33
mixin_version=0.8.5
neogradle.subsystems.parchment.minecraftVersion=1.21.1
neogradle.subsystems.parchment.mappingsVersion=2024.11.17
kommons_version=3.9.1
caffeine_cache_version=3.1.5
jei_version=19.16.4.171
jei_version=14.0.0.5
jupiter_version=5.9.2
curios_version=9.0.5
cosmetic_armor_reworked_id=5610814
ad_astra_id=4594155
botarium_id=4594094
resourceful_lib_id=4598948
resourceful_config_id=4576455
jade_id=5591256
mekanism_version=1.19.2-10.3.5.homebaked
curios_version=5.2.0-beta.2
cosmetic_armor_reworked_id=4575609
ad_astra_id=4452010
jade_id=4573193
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_version=2.0.10
kotlin_for_forge_version=3.1.0
kotlin_version=1.8.0
kotlin_coroutines_version=1.6.0
kotlin_serialization_version=1.3.2
handle_deps=true

Binary file not shown.

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
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
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

35
gradlew vendored
View File

@ -1,7 +1,7 @@
#!/bin/sh
#
# Copyright © 2015-2021 the original authors.
# Copyright © 2015-2021 the original authors.
#
# Licensed under the Apache License, Version 2.0 (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
# requires all of these POSIX shell features:
# * functions;
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
# * compound commands having a testable exit status, especially «case»;
# * various built-in commands including «command», «set», and «ulimit».
#
# Important for patching:
#
@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (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.
#
# You can find Gradle at https://github.com/gradle/gradle/.
@ -80,11 +80,14 @@ do
esac
done
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
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.
MAX_FD=maximum
@ -140,16 +143,12 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
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 ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | 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" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -194,10 +193,6 @@ if "$cygwin" || "$msys" ; then
done
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;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
@ -210,12 +205,6 @@ set -- \
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.
#
# 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
@if "%DEBUG%"=="" @echo off
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@ -25,8 +25,7 @@
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@ -41,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute
if "%ERRORLEVEL%" == "0" goto execute
echo.
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
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
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 {
repositories {
gradlePluginPortal()
maven(url = "https://maven.neoforged.net/releases")
}
}
@ -15,12 +14,29 @@ plugins {
buildscript {
repositories {
// These repositories are only for Gradle plugins, put any other repositories in the repository block further below
maven(url = "https://maven.neoforged.net/releases") {
name = "Neoforge"
maven(url = "https://maven.minecraftforge.net") {
name = "Minecraft Forge"
content {
includeGroup("net.neoforged.gradle")
includeGroup("net.neoforged")
includeGroup("net.minecraftforge.gradle")
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 forge_gradle_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.neoforged.gradle", name = "mixin", version = forge_gradle_version)
classpath(group = "net.minecraftforge.gradle", name = "ForgeGradle", version = forge_gradle_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")
}

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
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.world.damagesource.DamageEffects
import net.minecraft.world.damagesource.DamageScaling
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.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.BECOME_ANDROID, DamageType("otm_become_android", 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.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.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>) {
@ -37,20 +38,14 @@ fun registerDamageTypeTags(provider: TagsProvider.Delegate<DamageType>) {
.add(MDamageTypes.EMP)
.add(MDamageTypes.SHOCKWAVE)
.add(MDamageTypes.COSMIC_RAYS)
.add(MDamageTypes.ANDROID_DISCHARGE)
.add(MDamageTypes.NOT_NORMAL_PILL)
ignoreMagic
.add(MDamageTypes.EXOPACK_PROBE)
.add(MDamageTypes.BECOME_ANDROID)
.add(MDamageTypes.BECOME_HUMANE)
.add(MDamageTypes.COSMIC_RAYS)
.add(MDamageTypes.ANDROID_DISCHARGE)
.add(MDamageTypes.NOT_NORMAL_PILL)
ignoreInvl
.add(MDamageTypes.BECOME_HUMANE)
.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.registries.Registries
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.item.DyeColor
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.DoubleBlockHalf
import net.minecraft.world.level.block.state.properties.Half
import net.neoforged.bus.api.SubscribeEvent
import net.neoforged.fml.common.EventBusSubscriber
import net.neoforged.neoforge.client.model.generators.ModelFile
import net.neoforged.neoforge.common.data.AdvancementProvider
import net.neoforged.neoforge.common.data.DatapackBuiltinEntriesProvider
import net.neoforged.neoforge.data.event.GatherDataEvent
import net.neoforged.neoforge.registries.NeoForgeRegistries
import net.minecraftforge.client.model.generators.ModelFile
import net.minecraftforge.common.data.DatapackBuiltinEntriesProvider
import net.minecraftforge.common.data.ForgeAdvancementProvider
import net.minecraftforge.eventbus.api.SubscribeEvent
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.OverdriveThatMatters
import ru.dbotthepony.mc.otm.player.android.AndroidResearchDataProvider
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.WriteOnce
import ru.dbotthepony.mc.otm.android.AndroidResearchDataProvider
import ru.dbotthepony.mc.otm.block.*
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.util.WriteOnce
import ru.dbotthepony.mc.otm.datagen.blocks.BatteryBankProvider
import ru.dbotthepony.mc.otm.datagen.blocks.MatterBankProvider
import ru.dbotthepony.mc.otm.datagen.blocks.MatteryBlockStateProvider
import ru.dbotthepony.mc.otm.datagen.items.MatteryItemModelProvider
import ru.dbotthepony.mc.otm.datagen.lang.AddEnglishLanguage
import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.util.GJRAND64RandomSource
import ru.dbotthepony.mc.otm.data.FlywheelMaterialDataProvider
import ru.dbotthepony.mc.otm.datagen.recipes.MatteryRecipeProvider
import ru.dbotthepony.mc.otm.registry.*
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.advancements.addAdvancements
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.addComplexBlockStates
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.loot.*
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.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.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.DecorativeBlock
import kotlin.properties.Delegates
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 {
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()
private set
var itemModelProvider: MatteryItemModelProvider by WriteOnce()
@ -91,19 +82,12 @@ object DataGen {
private set
var matterData: MatterDataProvider by WriteOnce()
private set
var flywheelData: FlywheelMaterialDataProvider by WriteOnce()
private set
fun decorativeCubeAll(vararg blocks: Block) {
blockModelProvider.decorativeCubeAll(*blocks)
blockStateProvider.simpleBlockM(*blocks)
}
fun decorativeCubeAllCutout(vararg blocks: Block) {
blockModelProvider.decorativeCubeAllCutout(*blocks)
blockStateProvider.simpleBlockM(*blocks)
}
fun decorativeCubeAll(subdir: String, vararg blocks: Block) {
blockModelProvider.decorativeCubeAll(subdir, *blocks)
blockStateProvider.simpleBlockM(*blocks)
@ -129,11 +113,6 @@ object DataGen {
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) {
blockStateProvider.exec {
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) {
decorativeCubeAll(block)
}
@ -450,7 +429,7 @@ object DataGen {
}
}
fun decoratives(list: DecorativeBlock<*>) {
fun decoratives(list: DecorativeBlock) {
for (block in list.allBlocks.values) {
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) {
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) {
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) {
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) {
decorativeCubeAll(subdir, suffix, block)
}
@ -501,14 +480,15 @@ object DataGen {
}
@SubscribeEvent
@JvmStatic
@Suppress("unused")
fun onGatherData(event: GatherDataEvent) {
val blockModelProvider = MatteryBlockModelProvider(event)
val blockStateProvider = MatteryBlockStateProvider(event)
val itemModelProvider = MatteryItemModelProvider(event)
val lootTableProvider = LootTables(event)
val recipeProvider = MatteryRecipeProvider(event)
val lootModifier = LootModifiers(event)
val lootTableProvider = LootTables(event.generator)
val recipeProvider = MatteryRecipeProvider(event.generator)
val lootModifier = LootModifiers(event.generator)
val languageProvider = MatteryLanguageProvider(event.generator)
val matterData = MatterDataProvider(event)
val researchProvider = AndroidResearchDataProvider(event).also { it.exec { addResearchData(it, languageProvider) } }
@ -522,46 +502,35 @@ object DataGen {
this.languageProvider = languageProvider
this.researchProvider = researchProvider
this.matterData = matterData
this.flywheelData = FlywheelMaterialDataProvider(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 ->
addAdvancements(saver, languageProvider)
addAndroidAdvancements(saver, languageProvider)
addAdvancements(saver, existingFileHelper, languageProvider)
addAndroidAdvancements(saver, existingFileHelper, languageProvider)
addMachineAdvancements(saver, existingFileHelper, languageProvider)
}
)) {}
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.includeServer(), blockStateProvider)
event.generator.addProvider(event.includeClient(), itemModelProvider)
event.generator.addProvider(event.includeServer(), recipeProvider)
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), MatterBankProvider(event, it)) }
event.generator.addProvider(event.includeClient(), MatterBankProvider(event, null))
DyeColor.entries.forEach { event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, it)) }
event.generator.addProvider(event.includeClient(), BatteryBankProvider(event, null))
event.generator.addProvider(event.includeClient(), MatterBankProvider(event))
event.generator.addProvider(event.includeClient(), BatteryBankProvider(event))
event.generator.addProvider(event.includeServer(), lootTableProvider)
event.generator.addProvider(event.includeServer(), lootModifier)
event.generator.addProvider(event.includeServer(), SoundDataProvider(event))
event.generator.addProvider(event.includeServer(), researchProvider)
event.generator.addProvider(event.includeServer(), advancementProvider)
event.generator.addProvider(event.includeServer(), matterData)
event.generator.addProvider(event.includeServer(), flywheelData)
val registrySetBuilder = RegistrySetBuilder()
.add(Registries.DAMAGE_TYPE, ::registerDamageTypes)
.add(Registries.CONFIGURED_FEATURE, ::registerConfiguredFeatures)
.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)))
@ -575,7 +544,7 @@ object DataGen {
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()}"))
addBlockModels(blockModelProvider)
@ -586,31 +555,17 @@ object DataGen {
addItemModels(itemModelProvider)
blockStateProvider.exec { addComplexBlockStates(blockStateProvider) }
addLootTables(lootTableProvider)
addMachineLoot(lootTableProvider)
addDecorativeLoot(lootTableProvider)
addAdvancementLoot(lootTableProvider)
addVaultLoot(lootTableProvider)
addEntityLoot(lootTableProvider)
addChestLootTables(lootTableProvider)
recipeProvider.exec { _, consumer ->
addToolsRecipes(consumer)
addComponentRecipes(consumer)
addStorageItemRecipes(consumer)
addCraftingTableRecipes(consumer)
addMultiblockRecipes(consumer)
addBlastingRecipes(consumer)
addDecorativesRecipes(recipeProvider, consumer)
addMachineUpgradeRecipes(consumer)
addShapelessRecipes(consumer)
addOreSmeltingRecipes(consumer)
addPainterRecipes(consumer)
addMatterEntanglerRecipes(consumer)
addSuspiciousRecipes(consumer)
}
addPlatePressRecipes(recipeProvider)
addMicrowaveRecipes(recipeProvider)
lootModifier.lambda {
addLootModifiers(it)
@ -619,7 +574,6 @@ object DataGen {
languageProvider.registerProviders()
addMatterData(matterData)
addFlywheelMaterials(flywheelData)
tagsProvider.register()
}

View File

@ -1,24 +1,23 @@
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.SlabBlock
import net.minecraft.world.level.block.StairBlock
import net.minecraft.world.level.block.WallBlock
import net.minecraft.world.level.block.state.properties.BlockStateProperties
import net.neoforged.neoforge.client.model.generators.BlockModelBuilder
import net.neoforged.neoforge.client.model.generators.ConfiguredModel
import net.neoforged.neoforge.client.model.generators.ModelFile
import ru.dbotthepony.mc.otm.util.get
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.registryName
import net.minecraftforge.client.model.generators.BlockModelBuilder
import net.minecraftforge.client.model.generators.ConfiguredModel
import net.minecraftforge.client.model.generators.ModelFile
import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.blocks.MatteryBlockStateProvider
import ru.dbotthepony.mc.otm.datagen.items.MatteryItemModelProvider
import ru.dbotthepony.mc.otm.datagen.models.MatteryBlockModelProvider
import ru.dbotthepony.mc.otm.registry.game.MBlocks
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.registry.MRegistry
import kotlin.properties.Delegates
@ -35,42 +34,22 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
}
DataGen.decorativeCubeAll(MBlocks.CARBON_FIBRE_BLOCK)
DataGen.decorativeCubeAllCutout(MBlocks.METAL_MESH)
DataGen.decoratives(MRegistry.TRITANIUM_BLOCK)
for (color in DyeColor.entries) {
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.getVariantBuilder(anvil).forAllStates {
ConfiguredModel.builder()
.modelFile(blockStateProvider.models().getExistingFile(modLocation("block/${anvil.registryName!!.path}")))
.rotationY(it[AnvilBlock.FACING].yRotationBlockstateNorth())
.build()
}
for (anvil in MBlocks.TRITANIUM_ANVIL) {
blockStateProvider.exec {
blockStateProvider.getVariantBuilder(anvil).forAllStates {
ConfiguredModel.builder()
.modelFile(blockStateProvider.models().getExistingFile(modLocation("block/${anvil.registryName!!.path}")))
.rotationY(it[AnvilBlock.FACING].yRotationBlockstateNorth())
.build()
}
}
}
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) {
@ -98,7 +77,7 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
for ((color, block) in MRegistry.TRITANIUM_SLAB.allBlocks) {
blockStateProvider.exec {
blockStateProvider.slabBlock(
block,
block as SlabBlock,
MRegistry.TRITANIUM_BLOCK.allBlocks[color]!!.registryName!!,
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) {
blockStateProvider.exec {
blockStateProvider.slabBlock(
block,
block as SlabBlock,
MRegistry.FLOOR_TILES.blocks[color]!!.registryName!!,
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) {
DataGen.decorativeStairs(
block,
block as StairBlock,
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) {
DataGen.decorativeWall(
block,
block as WallBlock,
sideTexture = 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)
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)
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")
blockModelProvider.decorativeCubeAll(MBlocks.METAL_BEAM_CENTER, "metal_beam_top")
DataGen.decorativeCubeAll(MBlocks.DANGER_STRIPE_BLOCK)
DataGen.decorativeColumn(MBlocks.METAL_BEAM, "metal_beam_side", "metal_beam_top")
var labLampOn: 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_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)
blockStateProvider.block(MBlocks.METAL_BEAM_CENTER)
itemModelProvider.block(MItems.METAL_BEAM_CENTER)
blockStateProvider.exec {
blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP).forAllStates {
return@forAllStates ConfiguredModel.builder()
.modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!)
.rotationX(it[BlockRotationFreedom.DIRECTIONAL.property].front.xRotationBlockstateNorth())
.rotationY(it[BlockRotationFreedom.DIRECTIONAL.property].front.yRotationBlockstateNorth())
.rotationX(it[BlockRotationFreedom.TWO.property].front.xRotationBlockstateNorth())
.rotationY(it[BlockRotationFreedom.TWO.property].front.yRotationBlockstateNorth())
.build()
}
blockStateProvider.getVariantBuilder(MBlocks.LABORATORY_LAMP_INVERTED).forAllStates {
return@forAllStates ConfiguredModel.builder()
.modelFile(if (it[BlockStateProperties.LIT]) labLampOn!! else labLampOff!!)
.rotationX(it[BlockRotationFreedom.DIRECTIONAL.property].front.xRotationBlockstateNorth())
.rotationY(it[BlockRotationFreedom.DIRECTIONAL.property].front.yRotationBlockstateNorth())
.rotationX(it[BlockRotationFreedom.TWO.property].front.xRotationBlockstateNorth())
.rotationY(it[BlockRotationFreedom.TWO.property].front.yRotationBlockstateNorth())
.build()
}
}
@ -284,40 +247,26 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
blockModelProvider.exec {
for (crate in MRegistry.CARGO_CRATES.blocks.values) {
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}")
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}")
}
}
MBlocks.TRITANIUM_STRIPED_BLOCK.entries.forEach { (c, it) ->
DataGen.decorativeColumn(it, "stripe/tritanium_striped_block_${c.name.lowercase()}", "tritanium_block")
}
MBlocks.TRITANIUM_STRIPED_STAIRS.entries.forEach { (c, it) ->
DataGen.decorativeStairs(it, "stripe/tritanium_striped_block_${c.name.lowercase()}", "tritanium_block")
}
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)
DataGen.decorativeColumn(MBlocks.TRITANIUM_STRIPED_BLOCK, "tritanium_striped_block", "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")
itemModelProvider.block(MItems.TRITANIUM_STRIPED_STAIRS)
itemModelProvider.block(MItems.TRITANIUM_STRIPED_SLAB)
itemModelProvider.exec {
MBlocks.TRITANIUM_STRIPED_WALL.entries.forEach { (c, it) ->
itemModelProvider.withExistingParent(it.registryName!!.path, modLocation("block/wall_inventory"))
.texture("wall_side", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/stripe/tritanium_striped_block_${c.name.lowercase()}"))
.texture("wall", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_block"))
}
itemModelProvider.withExistingParent(MItems.TRITANIUM_STRIPED_WALL.registryName!!.path, modLocation("block/wall_inventory"))
.texture("wall_side", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_striped_block"))
.texture("wall", modLocation("${DataGen.DECORATIVE_BLOCK_LOCATION}/tritanium_block"))
}
for ((color, glass) in MRegistry.INDUSTRIAL_GLASS_PANE.allBlocks) {
@ -328,7 +277,6 @@ fun addDecorativeData(blockStateProvider: MatteryBlockStateProvider, itemModelPr
}
DataGen.bars(MBlocks.TRITANIUM_BARS, modLocation("block/decorative/tritanium_bars"))
DataGen.bars(MBlocks.METAL_RAILING, modLocation("block/decorative/metal_railing"))
blockStateProvider.block(MBlocks.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.world.item.Item
import net.minecraft.world.item.Items
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.util.math.Decimal
import net.minecraftforge.common.Tags
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.MatterFunction
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
// 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.DAMAGED_ANVIL, Items.ANVIL, 0.5)
for (anvils in MItems.TRITANIUM_ANVIL.values) {
for (i in 1 until anvils.size) {
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)
for (i in 1 until MItems.TRITANIUM_ANVIL.size) {
provider.inherit(MItems.TRITANIUM_ANVIL[i], MItems.TRITANIUM_ANVIL[i - 1], 0.85)
}
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.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) {
blacklist(Tags.Items.RAW_MATERIALS)
blacklist(Tags.Items.RAW_MATERIALS_COPPER)
@ -153,12 +121,12 @@ fun addMatterData(provider: MatterDataProvider) {
relative(Items.PACKED_ICE, 1.5, 1)
// rocks
scope(Tags.Items.STONES, 1.1, 1.1) {
equal(Tags.Items.COBBLESTONES)
equal(Tags.Items.GRAVELS)
scope(Tags.Items.STONE, 1.1, 1.1) {
equal(Tags.Items.COBBLESTONE)
equal(Tags.Items.GRAVEL)
equal(Items.FLINT)
equal(Tags.Items.SANDS)
equal(Tags.Items.NETHERRACKS)
equal(Tags.Items.SAND)
equal(Tags.Items.NETHERRACK)
scope(1.4, 1.5) {
equal(Items.BASALT)
@ -186,7 +154,7 @@ fun addMatterData(provider: MatterDataProvider) {
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)
}
@ -222,7 +190,7 @@ fun addMatterData(provider: MatterDataProvider) {
// drops from mobs
scope(Items.ROTTEN_FLESH, 8, 1.5) {
equal(Items.INK_SAC)
equal(Tags.Items.LEATHERS)
equal(Tags.Items.LEATHER)
equal(Items.LEATHER)
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.STRINGS, 0.8, 0.75)
relative(Tags.Items.STRING, 0.8, 0.75)
relative(Items.COBWEB, 0.8, 0.75)
relative(Items.SPIDER_EYE, 0.8, 1.8)
relative(Tags.Items.SLIME_BALLS, 1, 1.4)
relative(Tags.Items.GUNPOWDERS, 0.85, 1.15)
relative(Tags.Items.SLIMEBALLS, 1, 1.4)
relative(Tags.Items.GUNPOWDER, 0.85, 1.15)
relative(Items.TURTLE_SCUTE, 1, 1.5)
relative(Items.ARMADILLO_SCUTE, 1, 1.8)
relative(Items.SCUTE, 1, 1.5)
relative(Items.FEATHER, 0.7, 1.25)
relative(Items.EGG, 1.25, 4)
@ -263,7 +230,7 @@ fun addMatterData(provider: MatterDataProvider) {
relative(Items.SCULK_VEIN, 2.5, 24)
// planty
scope(Items.SHORT_GRASS, 1.5, 2.5) {
scope(Items.GRASS, 1.5, 2.5) {
equal(Items.SUNFLOWER)
equal(Items.LILAC)
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.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.player.android.AndroidResearchDescriptions
import ru.dbotthepony.mc.otm.player.android.AndroidResearchResults
import ru.dbotthepony.mc.otm.player.android.AndroidResearchType
import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.android.feature.EnderTeleporterFeature
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.util.TextComponent
import ru.dbotthepony.mc.otm.util.TranslatableComponent
import ru.dbotthepony.mc.otm.core.TextComponent
import ru.dbotthepony.mc.otm.core.TranslatableComponent
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.game.MItems
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MNames
import java.util.LinkedList
import java.util.function.Consumer
@ -43,45 +47,6 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
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))
.withExperience(24)
.addFeatureResult(AndroidFeatures.STEP_ASSIST)
@ -138,7 +103,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS))
.addFeatureResult(OverdriveThatMatters.loc(MNames.NANOBOTS_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.COPPER_WIRES, 8)
.build()
@ -163,18 +128,15 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
TranslatableComponent(
"android_research.overdrive_that_matters.limb_overclocking.description",
(i + 1) * 8,
(i + 1) * 6,
(i + 1) * 20
(i + 1) * 6
)
)
.addItem(MItemTags.COPPER_WIRES, 4 + i * 2)
.addFeatureResult(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING), i)
if (i > 0) {
research.addFeatureLevel(AndroidFeatures.LIMB_OVERCLOCKING)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING_LIST[i - 1]), optional = true)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.LIMB_OVERCLOCKING_LIST[i - 1]), rigid = true)
research.addItem(MItemTags.GOLD_WIRES, i * 2)
} else {
research.addFeatureResult(AndroidFeatures.LIMB_OVERCLOCKING)
}
research.build()
@ -193,23 +155,18 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
(i + 1) * 15
)
)
.addItem(MItems.ELECTROMAGNET, 2 + i)
.addItem(MItemTags.GOLD_WIRES, 4 * i + 8)
.addItem(MItemTags.PISTONS)
.addFeatureResult(AndroidFeatures.ATTACK_BOOST, i)
.addBlocker(NANOBOTS_ARMOR)
if (i > 0) {
research.addFeatureLevel(AndroidFeatures.ATTACK_BOOST)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.ATTACK_BOOST_LIST[i - 1]), optional = true)
} else {
research.addFeatureResult(AndroidFeatures.ATTACK_BOOST)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.ATTACK_BOOST_LIST[i - 1]), rigid = true)
}
research.build()
})
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)
.withIconText(TextComponent((i + 1).toString()))
.withIcon(ResearchIcons.ICON_NANOBOTS)
@ -222,16 +179,15 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
.addItem(MItems.MATTER_CAPACITOR_PARTS, 1)
.addItem(Items.SUGAR, 2 + i * 2)
.addItem(Tags.Items.DUSTS_REDSTONE, 2 + i * 2)
.addFeatureResult(AndroidFeatures.NANOBOTS_REGENERATION, i)
if (i > 0) {
research.addFeatureLevel(AndroidFeatures.NANOBOTS_REGENERATION)
research.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS_REGENERATION_LIST[i - 1]), optional = true)
regeneration.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS_REGENERATION_LIST[i - 1]), rigid = true)
} else {
research.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS), optional = true)
research.addFeatureResult(AndroidFeatures.NANOBOTS_REGENERATION)
regeneration.addPrerequisite(OverdriveThatMatters.loc(MNames.NANOBOTS), rigid = true)
}
research.build()
regeneration.build()
})
}
@ -260,7 +216,10 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
.addItem(MItemTags.TRITANIUM_PLATES, 2 + i * 2)
.addItem(Items.SUGAR, 1 + i)
.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()
})
@ -284,7 +243,10 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
)
)
.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()
})
}
@ -299,7 +261,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.SHOCKWAVE))
.withExperience(40)
.withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.SHOCKWAVE)
.appendDescription(ShockwaveFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_SHOCKWAVE)
.addFeatureResult(AndroidFeatures.SHOCKWAVE)
.addPrerequisite(attackBoostList[2])
@ -314,7 +276,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.ITEM_MAGNET))
.withExperience(28)
.withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.ITEM_MAGNET)
.appendDescription(ItemMagnetFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_ITEM_MAGNET)
.addFeatureResult(AndroidFeatures.ITEM_MAGNET)
.addPrerequisite(STEP_ASSIST)
@ -330,9 +292,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_1"))
.withExperience(25)
.withDescription()
.withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(1))
.appendDescription(FallDampenersFeature.DESCRIPTION.bind(1))
.withIcon(ResearchIcons.ICON_FEATHER_FALLING)
.addFeatureResult(AndroidFeatures.FALL_DAMPENERS)
.addFeatureResult(AndroidFeatures.FALL_DAMPENERS, 0)
.addPrerequisite(STEP_ASSIST)
.addItem(MItems.ELECTROMAGNET, 2)
.addItem(ItemTags.WOOL, 2)
@ -343,9 +305,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_2"))
.withExperience(30)
.withDescription()
.withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(2))
.appendDescription(FallDampenersFeature.DESCRIPTION.bind(2))
.withIcon(ResearchIcons.ICON_FEATHER_FALLING)
.addFeatureLevel(AndroidFeatures.FALL_DAMPENERS)
.addFeatureResult(AndroidFeatures.FALL_DAMPENERS, 1)
.addPrerequisite(FALL_DAMPENERS_1)
.addItem(MItemTags.GOLD_PLATES, 2)
.addItem(MItemTags.COPPER_WIRES, 4)
@ -357,9 +319,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.FALL_DAMPENERS + "_3"))
.withExperience(35)
.withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.FALL_DAMPENERS.Instance(3))
.appendDescription(FallDampenersFeature.DESCRIPTION.bind(3))
.withIcon(ResearchIcons.ICON_FEATHER_FALLING)
.addFeatureLevel(AndroidFeatures.FALL_DAMPENERS)
.addFeatureResult(AndroidFeatures.FALL_DAMPENERS, 2)
.addPrerequisite(FALL_DAMPENERS_2)
.addItem(MItemTags.ADVANCED_CIRCUIT, 2)
.addItem(Tags.Items.GEMS_DIAMOND, 4)
@ -375,7 +337,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.ENDER_TELEPORTER))
.withExperience(35)
.withDescription()
.withDescription(AndroidResearchDescriptions.ENDER_TELEPORTER)
.appendDescription(EnderTeleporterFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_ENDER_TELEPORT)
.addFeatureResult(AndroidFeatures.ENDER_TELEPORTER)
.addPrerequisite(FALL_DAMPENERS_1)
@ -388,13 +350,27 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
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 =
AndroidResearchType.Builder(modLocation(MNames.JUMP_BOOST + "_1"))
.withExperience(27)
.withDescription(0 .. 1)
.withDescription(AndroidResearchDescriptions.JUMP_BOOST)
.appendDescription(JumpBoostFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_JUMP_BOOST)
.addFeatureResult(AndroidFeatures.JUMP_BOOST)
.addFeatureResult(AndroidFeatures.JUMP_BOOST, 0)
.addItem(MItemTags.PISTONS, 2)
.addItem(MItemTags.GOLD_WIRES, 4)
.addItem(MItems.ELECTROMAGNET, 2)
@ -406,9 +382,9 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
AndroidResearchType.Builder(modLocation(MNames.JUMP_BOOST + "_2"))
.withExperience(34)
.withDescription()
.withDescription(AndroidResearchDescriptions.JUMP_BOOST)
.appendDescription(JumpBoostFeature.POWER_COST_DESCRIPTION)
.withIcon(ResearchIcons.ICON_JUMP_BOOST)
.addFeatureLevel(AndroidFeatures.JUMP_BOOST)
.addFeatureResult(AndroidFeatures.JUMP_BOOST, 1)
.addItem(MItems.ELECTRIC_PARTS, 4)
.addItem(MItems.ELECTROMAGNET, 4)
.addPrerequisite(JUMP_BOOST_1)
@ -419,20 +395,20 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
serializer.accept(JUMP_BOOST_2)
with(lang) {
misc("fall_dampeners.description", "Reduces fall damage by %s%% and increases fall damage flat resist by %s half a hearts") {
russian("Уменьшает урон от падения на %s%% и повышает сопротивление урону от падения на %s полусердец")
misc("fall_dampeners.description", "Reduces fall damage by %s%%") {
russian("Уменьшает урон от падения на %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%%") {
russian("Увеличивает мобильность на %s%%, скорость атак на %s%% и скорость чистки блоков на %s%%")
add(limbList[0], "description", "Boosts mobility by %s%% and attack speed by %s%%") {
russian("Увеличивает мобильность на %s%% и скорость атак на %s%%")
}
add(AIR_BAGS, "Air Bags") {
russian("Воздушные мешки")
russian("Воздушные Мешки")
}
add(NANOBOTS, "Nanobots") {
russian("Наноботы")
@ -455,64 +431,49 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
}
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") {
russian("Позволяет наноботам выстраиваться в клеточную структуру, уменьшая внешний урон на определённый проект путём поглощения ударов")
}
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") {
russian("Уменьшает время необходимое наноботам для формирования защитного слоя")
}
add(armorStrengthList[0], "Nanobots Armor Strength %s") {
russian("Сила слоя брони наноботов %s")
russian("Сила Слоя Брони Наноботов %s")
}
add(armorStrengthList[0], "description", "Increases impact absorption strength of nanobots") {
russian("Увеличивает поглощающею силу брони наноботов")
}
add(EXTENDED_REACH, "Extended Reach") {
russian("Удлинённые манипуляторы")
russian("Удлинённые Манипуляторы")
}
add(EXTENDED_REACH, "description", "Increases block interaction distance") {
russian("Увеличивает радиус взаимодействия с блоками")
}
add(IMPROVED_LIMBS, "Improved Limbs") {
russian("Улучшенные конечности")
russian("Улучшенные Конечности")
}
add(IMPROVED_LIMBS, "description", "Allows limbs to be upgraded") {
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") {
russian("Помощь подъёма")
russian("Помощь Подъёма")
}
add(STEP_ASSIST, "description", "Allows unit to step up whole blocks") {
russian("Позволяет переступать полные блоки")
}
add(ITEM_MAGNET, "Item Magnet") {
russian("Предметный магнит")
russian("Предметный Магнит")
}
add(ITEM_MAGNET, "description0", "Pulls nearby items while active") {
russian("Притягивает ближайшие предметы пока активен")
@ -522,21 +483,21 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
}
add(FALL_DAMPENERS_1, "Fall Dampeners") {
russian("Поглотители инерции")
russian("Поглотители Инерции")
}
add(FALL_DAMPENERS_1, "description", "Installs basic equipment in limbs to negate some fall damage") {
russian("Обустраивает конечности примитивными деталями для небольшого смягчения падения")
}
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") {
russian("Оборудует конечности микро смещающимися и смягчающим оборудованием, которое поглощает значительный урон от падения")
}
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") {
russian("Устанавливает автономные матрицы калькуляции избегания урона от падения, а так же усиливает защиту важных деталей")
@ -546,7 +507,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
}
add(SHOCKWAVE, "Shockwave Pulsator") {
russian("Генератор ударных волн")
russian("Генератор Ударных Волн")
}
add(SHOCKWAVE, "description0", "Releases a shockwave, damaging everything in small radius, as you quickly land on ground") {
russian("Вызывает ударную волну при стремительном падении на землю, нанося урон всему, что вас окружает")
@ -555,8 +516,15 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
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") {
russian("Усилитель прыжка")
russian("Усилитель Прыжка")
}
add(JUMP_BOOST_1, "description0", "Allows to perform higher jump") {
russian("Позволяет совершить высокий прыжок")
@ -566,7 +534,7 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
}
add(JUMP_BOOST_2, "Jump Boost 2") {
russian("Усилитель прыжка 2")
russian("Усилитель Прыжка 2")
}
add(JUMP_BOOST_2, "description", "Allows to perform extra higher jump") {
russian("Позволяет совершить ещё более высокий прыжок")
@ -580,14 +548,14 @@ fun addResearchData(serializer: Consumer<AndroidResearchType>, lang: MatteryLang
}
add(NIGHT_VISION, "Night Vision") {
russian("Ночное зрение")
russian("Ночное Зрение")
}
add(NIGHT_VISION, "description", "Allows to clearly see in the dark") {
russian("Позволяет видеть в темноте")
}
add(attackBoostList[0], "Attack Boost %s") {
russian("Усиление атаки %s")
russian("Усиление Атаки %s")
}
add(attackBoostList[0], "description", "Increases total melee attack strength by %s%%") {
russian("Увеличивает урон в ближнем бою на %s%%")

View File

@ -1,10 +1,11 @@
package ru.dbotthepony.mc.otm.datagen
import net.minecraft.resources.ResourceLocation
import net.minecraft.sounds.SoundEvent
import net.neoforged.neoforge.common.data.SoundDefinition
import net.neoforged.neoforge.common.data.SoundDefinitionsProvider
import net.neoforged.neoforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.registry.game.MSoundEvents
import net.minecraftforge.common.data.SoundDefinition
import net.minecraftforge.common.data.SoundDefinitionsProvider
import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.registry.MSoundEvents
fun SoundDefinition.subtitle(value: SoundEvent): SoundDefinition {
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) {
override fun registerSounds() {
add(
MSoundEvents.PLASMA_WEAPON_OVERHEAT,
add(MSoundEvents.PLASMA_WEAPON_OVERHEAT,
definition().subtitle("otm.sound.plasma_weapon_overheat")
.with(SoundDefinition.Sound.sound(modLocation("item/plasma_weapon_overheat"), SoundDefinition.SoundType.SOUND)))
add(
MSoundEvents.PLAYER_BECOME_ANDROID,
add(MSoundEvents.PLAYER_BECOME_ANDROID,
definition().subtitle("otm.sound.player_become_android")
.with(SoundDefinition.Sound.sound(modLocation("player_become_android"), SoundDefinition.SoundType.SOUND)))
add(
MSoundEvents.RIFLE_SHOT,
add(MSoundEvents.RIFLE_SHOT,
definition().subtitle("otm.sound.rifle_shot")
.with(SoundDefinition.Sound.sound(modLocation("item/rifle_shot"), SoundDefinition.SoundType.SOUND)))
simple(MSoundEvents.CARGO_CRATE_OPEN)
add(
MSoundEvents.ANDROID_JUMP_BOOST,
add(MSoundEvents.ANDROID_JUMP_BOOST,
definition().subtitle("otm.sound.android.jump_boost")
.with(SoundDefinition.Sound.sound(modLocation("android/jump_boost"), SoundDefinition.SoundType.SOUND)))
add(
MSoundEvents.ANDROID_SHOCKWAVE,
add(MSoundEvents.ANDROID_SHOCKWAVE,
definition().subtitle("otm.sound.android.shockwave")
.with(SoundDefinition.Sound.sound(modLocation("android/shockwave"), SoundDefinition.SoundType.SOUND)))
add(
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,
add(MSoundEvents.ANDROID_PROJ_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) {

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
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementRewards
import net.minecraft.advancements.AdvancementRequirements.Strategy
import net.minecraft.advancements.AdvancementType
import net.minecraft.advancements.FrameType
import net.minecraft.advancements.RequirementsStrategy
import net.minecraft.advancements.critereon.InventoryChangeTrigger
import net.minecraft.world.item.DyeColor
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.modLocation
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.server.triggers.BlackHoleTrigger
import ru.dbotthepony.mc.otm.server.triggers.NailedEntityTrigger
import ru.dbotthepony.mc.otm.triggers.BlackHoleTrigger
import ru.dbotthepony.mc.otm.triggers.NailedEntityTrigger
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 root = AdvancementBuilder()
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.display(
itemStack = ItemStack(MItems.TRITANIUM_INGOT),
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_clump", criterion(MItemTags.TRITANIUM_ORE_CLUMPS))
.addCriterion("has_tritanium_ingot", InventoryChangeTrigger.TriggerInstance.hasItems(MItems.TRITANIUM_INGOT))
.save(serializer, modLocation("regular/root"))
addMachineAdvancements(serializer, lang, root)
.save(serializer, modLocation("regular/root"), existingFileHelper)
val crude = AdvancementBuilder()
.parent(root)
@ -51,7 +50,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_item", criterion(MItems.BATTERY_CRUDE))
.save(serializer, modLocation("regular/crude_battery"))
.save(serializer, modLocation("regular/crude_battery"), existingFileHelper)
val normal = AdvancementBuilder()
.parent(crude)
@ -65,7 +64,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_item", criterion(MItems.BATTERY_NORMAL))
.save(serializer, modLocation("regular/normal_battery"))
.save(serializer, modLocation("regular/normal_battery"), existingFileHelper)
AdvancementBuilder()
.parent(normal)
@ -79,7 +78,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_item", criterion(MItems.BATTERY_DENSE))
.save(serializer, modLocation("regular/dense_battery"))
.save(serializer, modLocation("regular/dense_battery"), existingFileHelper)
val capacitor = AdvancementBuilder()
.parent(normal)
@ -93,7 +92,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_item", criterion(MItems.BATTERY_CAPACITOR))
.save(serializer, modLocation("regular/capacitor_battery"))
.save(serializer, modLocation("regular/capacitor_battery"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Получите высокочастотный клинок, оружие ближнего боя предназначенное для нарезания Криперов на крипо-тортики")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.addCriterion("has_item", criterion(MItems.ENERGY_SWORD))
.save(serializer, modLocation("regular/energy_sword"))
.save(serializer, modLocation("regular/energy_sword"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Создайте квантовый аккумулятор, пропитанную технологиями Края")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.rewards(AdvancementRewards.Builder.experience(50))
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.addCriterion("has_item0", criterion(MItems.QUANTUM_BATTERY))
.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)
.display(
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") {
russian("Найдите модуль нулевой точки, вещь из другой мультивселенной, созданная с использованием технологий, потерянных во времени во всех возможных мультивслеленных")
},
frameType = AdvancementType.CHALLENGE,
frameType = FrameType.CHALLENGE,
hidden = true
)
.rewards(AdvancementRewards.Builder.experience(800))
.addCriterion("has_item", criterion(MItems.ZPM_BATTERY))
.save(serializer, modLocation("regular/zpm_battery"))
addExopackAdvancements(serializer, lang, root, zpm)
.save(serializer, modLocation("regular/zpm_battery"), existingFileHelper)
val blackhole = AdvancementBuilder()
.parent(root)
@ -159,8 +156,8 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
hidden = true
)
.addCriterion("pulled_by_black_hole", BlackHoleTrigger.criterion)
.save(serializer, modLocation("regular/black_hole"))
.addCriterion("pulled_by_black_hole", BlackHoleTrigger.Instance)
.save(serializer, modLocation("regular/black_hole"), existingFileHelper)
AdvancementBuilder()
.parent(blackhole)
@ -174,7 +171,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_item", criterion(MItems.BLACK_HOLE_SCANNER))
.save(serializer, modLocation("regular/black_hole_scanner"))
.save(serializer, modLocation("regular/black_hole_scanner"), existingFileHelper)
AdvancementBuilder()
.parent(blackhole)
@ -188,7 +185,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_item", criterion(MItems.GRAVITATION_STABILIZER))
.save(serializer, modLocation("regular/stabilizer"))
.save(serializer, modLocation("regular/stabilizer"), existingFileHelper)
AdvancementBuilder()
.parent(blackhole)
@ -202,11 +199,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_item", criterion(MItems.PORTABLE_GRAVITATION_STABILIZER))
.save(serializer, modLocation("regular/portable_stabilizer"))
.save(serializer, modLocation("regular/portable_stabilizer"), existingFileHelper)
val ore = AdvancementBuilder()
.parent(root)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.display(
itemStack = ItemStack(MItems.TRITANIUM_ORE_CLUMP),
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_clump", criterion(MItemTags.TRITANIUM_ORE_CLUMPS))
.save(serializer, modLocation("regular/ore"))
.save(serializer, modLocation("regular/ore"), existingFileHelper)
val ingot = AdvancementBuilder()
.parent(ore)
@ -232,7 +229,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_tritanium_ingot", criterion(MItemTags.TRITANIUM_INGOTS))
.save(serializer, modLocation("regular/ingot"))
.save(serializer, modLocation("regular/ingot"), existingFileHelper)
AdvancementBuilder()
.parent(ingot)
@ -246,7 +243,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
},
)
.addCriterion("has_tritanium_pickaxe", criterion(MItems.TRITANIUM_PICKAXE))
.save(serializer, modLocation("regular/pickaxe"))
.save(serializer, modLocation("regular/pickaxe"), existingFileHelper)
AdvancementBuilder()
.parent(ingot)
@ -261,7 +258,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
hidden = true
)
.addCriterion("hoe", criterion(MItems.TRITANIUM_HOE))
.save(serializer, modLocation("regular/hoe"))
.save(serializer, modLocation("regular/hoe"), existingFileHelper)
val plate = AdvancementBuilder()
.parent(ingot)
@ -275,7 +272,7 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
}
)
.addCriterion("has_item", criterion(MItemTags.TRITANIUM_PLATES))
.save(serializer, modLocation("regular/plate"))
.save(serializer, modLocation("regular/plate"), existingFileHelper)
AdvancementBuilder()
.parent(plate)
@ -288,12 +285,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Согните немного тритановых пластин вместе с углеродной сеткой в невероятно прочную броню")
}
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.addCriterion("has_item0", criterion(MItems.TRITANIUM_HELMET))
.addCriterion("has_item1", criterion(MItems.TRITANIUM_CHESTPLATE))
.addCriterion("has_item2", criterion(MItems.TRITANIUM_PANTS))
.addCriterion("has_item3", criterion(MItems.TRITANIUM_BOOTS))
.save(serializer, modLocation("regular/armor"))
.save(serializer, modLocation("regular/armor"), existingFileHelper)
AdvancementBuilder()
.parent(ingot)
@ -306,12 +303,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Создайте простую тритановую броню из слитков, просто и эффективно")
}
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.addCriterion("has_item0", criterion(MItems.SIMPLE_TRITANIUM_HELMET))
.addCriterion("has_item1", criterion(MItems.SIMPLE_TRITANIUM_CHESTPLATE))
.addCriterion("has_item2", criterion(MItems.SIMPLE_TRITANIUM_PANTS))
.addCriterion("has_item3", criterion(MItems.SIMPLE_TRITANIUM_BOOTS))
.save(serializer, modLocation("regular/simple_armor"))
.save(serializer, modLocation("regular/simple_armor"), existingFileHelper)
val glass = AdvancementBuilder()
.parent(plate)
@ -324,19 +321,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("В инструкции указано что оно должно быть пуленепробиваемо.")
}
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.also { advancement ->
MRegistry.INDUSTRIAL_GLASS.allItems.values.forEach { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
}
.save(serializer, modLocation("regular/industrial_glass"))
CraftEntry(
MItems.FLUID_TANK, "Liquid Packaging",
russianName = "Упаковка для жидкостей").make(serializer, glass, translation)
CraftEntry(
MItems.FLUID_CAPSULE, "Liquid Canning",
russianName = "Банка для жидкостей").make(serializer, glass, translation)
.save(serializer, modLocation("regular/industrial_glass"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Покрасьте промышленное стекло во все возможные цвета")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.requirements(Strategy.AND)
.requirements(RequirementsStrategy.AND)
.also { advancement ->
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()
.parent(plate)
@ -367,11 +356,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Грузовые ящики, будто двойные сундуки, но одинарные.")
}
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.also { advancement ->
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()
.parent(cargoCrate)
@ -384,11 +373,11 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Сбросьте грузовой ящик в вагонетку и посмотрите, что получится")
}
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.also { advancement ->
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()
.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") {
russian("Создайте все варианты покрасок вагонеток с грузовыми Ящиками")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.requirements(Strategy.AND)
.requirements(RequirementsStrategy.AND)
.also { advancement ->
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()
.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") {
russian("Покрасьте грузовые ящики во все возможные цвета")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.requirements(Strategy.AND)
.requirements(RequirementsStrategy.AND)
.also { advancement ->
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()
.parent(ingot)
.parent(plate)
.display(
itemStack = ItemStack(MRegistry.TRITANIUM_BLOCK.item),
title = translation.add("tritanium_block", "Cold, Impregnable Wall") {
@ -437,21 +426,21 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Покройте булыжник в тритане, дешёвый, но невероятно прочный материал")
}
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.also { advancement ->
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_STAIRS.allItems.values.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_STAIRS.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.also { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
}
.save(serializer, modLocation("regular/tritanium_block"))
.save(serializer, modLocation("regular/tritanium_block"), existingFileHelper)
AdvancementBuilder()
.parent(tritaniumBlock)
.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") {
russian("Старомодная цветовая отделка")
},
@ -459,12 +448,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Бледно синяя покраска с жёлтой полоской, я готов поспорить вы знаете чей это дизайн")
}
)
.requirements(Strategy.OR)
.addCriterion("has_item", criterion(MItems.TRITANIUM_STRIPED_BLOCK[DyeColor.YELLOW]!!))
.addCriterion("has_item1", criterion(MItems.TRITANIUM_STRIPED_STAIRS[DyeColor.YELLOW]!!))
.addCriterion("has_item2", criterion(MItems.TRITANIUM_STRIPED_SLAB[DyeColor.YELLOW]!!))
.addCriterion("has_item3", criterion(MItems.TRITANIUM_STRIPED_WALL[DyeColor.YELLOW]!!))
.save(serializer, modLocation("regular/striped_tritanium_block"))
.requirements(RequirementsStrategy.OR)
.addCriterion("has_item", criterion(MItems.TRITANIUM_STRIPED_BLOCK))
.addCriterion("has_item1", criterion(MItems.TRITANIUM_STRIPED_STAIRS))
.addCriterion("has_item2", criterion(MItems.TRITANIUM_STRIPED_SLAB))
.addCriterion("has_item3", criterion(MItems.TRITANIUM_STRIPED_WALL))
.save(serializer, modLocation("regular/striped_tritanium_block"), existingFileHelper)
val colorTritaniumBlock = AdvancementBuilder()
.parent(tritaniumBlock)
@ -477,16 +466,16 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Покрасьте тритановый блок для придания ему сказочных оттенков")
}
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.also { advancement ->
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_STRIPED_BLOCK.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_STAIRS.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.also { advancement.addCriterion(it.registryName!!.path, criterion(it)) }
}
.save(serializer, modLocation("regular/tritanium_block2"))
.save(serializer, modLocation("regular/tritanium_block2"), existingFileHelper)
val colorfulTritaniumBlock = AdvancementBuilder()
.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") {
russian("Создайте все варианты покрасок тритановых Блоков")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.rewards(advancementLoot("tritanium_block3").addExperience(100))
.requirements(Strategy.AND)
.rewards(AdvancementRewards.Builder.loot(modLocation("tritanium_block3")).addExperience(100))
.requirements(RequirementsStrategy.AND)
.also { advancement ->
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()
.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") {
russian("Создайте АБСОЛЮТНО ВСЕ варианты покрасок тритановых блоков, включая с полосками")
},
frameType = AdvancementType.CHALLENGE
frameType = FrameType.CHALLENGE
)
.rewards(advancementLoot("tritanium_block4").addExperience(400))
.requirements(Strategy.AND)
.rewards(AdvancementRewards.Builder.loot(modLocation("tritanium_block4")).addExperience(400))
.requirements(RequirementsStrategy.AND)
.also { advancement ->
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)) }
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()
.parent(root)
@ -539,12 +528,12 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Найдите одну из этих ваших мистических пилюль")
},
)
.requirements(Strategy.OR)
.also {
for ((i, item) in MItems.PILLS.withIndex())
it.addCriterion("pill$i", criterion(item))
}
.save(serializer, modLocation("regular/pill"))
.requirements(RequirementsStrategy.OR)
.addCriterion("pill1", criterion(MItems.PILL_ANDROID))
.addCriterion("pill2", criterion(MItems.PILL_HEAL))
.addCriterion("pill3", criterion(MItems.PILL_HUMANE))
.addCriterion("pill4", criterion(MItems.PILL_OBLIVION))
.save(serializer, modLocation("regular/pill"), existingFileHelper)
AdvancementBuilder()
.parent(pill)
@ -556,18 +545,18 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
description = translation.add("all_pills.desc", "Find all possible pill types") {
russian("Найдите всевозможные варианты пилюль")
},
frameType = AdvancementType.CHALLENGE,
frameType = FrameType.CHALLENGE,
hidden = true
)
.rewards(AdvancementRewards.Builder.experience(200))
.requirements(Strategy.AND)
.also {
for ((i, item) in MItems.PILLS.withIndex())
it.addCriterion("pill$i", criterion(item))
}
.save(serializer, modLocation("regular/all_pills"))
.requirements(RequirementsStrategy.AND)
.addCriterion("pill1", criterion(MItems.PILL_ANDROID))
.addCriterion("pill2", criterion(MItems.PILL_HEAL))
.addCriterion("pill3", criterion(MItems.PILL_HUMANE))
.addCriterion("pill4", criterion(MItems.PILL_OBLIVION))
.save(serializer, modLocation("regular/all_pills"), existingFileHelper)
val essenceCapsule = AdvancementBuilder()
AdvancementBuilder()
.parent(root)
.display(
itemStack = ItemStack(MItems.ESSENCE_CAPSULE),
@ -578,10 +567,10 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Верните капсулу эссенции. Воспоминания...")
},
)
.requirements(Strategy.OR)
.requirements(RequirementsStrategy.OR)
.addCriterion("essence1", criterion(MItems.ESSENCE_CAPSULE))
.addCriterion("essence2", criterion(MItems.ESSENCE_DRIVE))
.save(serializer, modLocation("regular/essence_capsule"))
.save(serializer, modLocation("regular/essence_capsule"), existingFileHelper)
AdvancementBuilder()
.parent(root)
@ -594,10 +583,6 @@ fun addAdvancements(serializer: Consumer<AdvancementHolder>, lang: MatteryLangua
russian("Пригвоздите что-либо (или кого-либо)")
}
)
.addCriterion("damage", NailedEntityTrigger.Instance().criterion())
.save(serializer, modLocation("regular/explosive_hammer"))
CraftEntry(
MItems.ESSENCE_STORAGE.values, "Did not Forget to Remember",
russianName = "Не забыл запомнить").make(serializer, essenceCapsule, translation)
.addCriterion("damage", NailedEntityTrigger.Instance())
.save(serializer, modLocation("regular/explosive_hammer"), existingFileHelper)
}

View File

@ -1,38 +1,38 @@
package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.AdvancementRequirements.Strategy
import net.minecraft.advancements.Advancement
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.ItemPredicate
import net.minecraft.advancements.critereon.MinMaxBounds.Doubles
import net.minecraft.world.entity.EntityType
import net.minecraft.world.item.ItemStack
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.lang.MatteryLanguageProvider
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.game.AndroidFeatures
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.AndroidFeatures
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MNames
import ru.dbotthepony.mc.otm.server.triggers.AndroidBatteryTrigger
import ru.dbotthepony.mc.otm.server.triggers.AndroidResearchTrigger
import ru.dbotthepony.mc.otm.server.triggers.AndroidTravelUnderwater
import ru.dbotthepony.mc.otm.server.triggers.BecomeAndroidDeathTrigger
import ru.dbotthepony.mc.otm.server.triggers.BecomeAndroidSleepTrigger
import ru.dbotthepony.mc.otm.server.triggers.BecomeAndroidTrigger
import ru.dbotthepony.mc.otm.server.triggers.BecomeHumaneTrigger
import ru.dbotthepony.mc.otm.server.triggers.EnderTeleporterFallDeathTrigger
import ru.dbotthepony.mc.otm.server.triggers.FallDampenersSaveTrigger
import ru.dbotthepony.mc.otm.server.triggers.KillAsAndroidTrigger
import ru.dbotthepony.mc.otm.server.triggers.NanobotsArmorTrigger
import ru.dbotthepony.mc.otm.server.triggers.ShockwaveDamageMobTrigger
import ru.dbotthepony.mc.otm.server.triggers.ShockwaveTrigger
import java.util.*
import ru.dbotthepony.mc.otm.triggers.AndroidBatteryTrigger
import ru.dbotthepony.mc.otm.triggers.AndroidResearchTrigger
import ru.dbotthepony.mc.otm.triggers.AndroidTravelUnderwater
import ru.dbotthepony.mc.otm.triggers.BecomeAndroidDeathTrigger
import ru.dbotthepony.mc.otm.triggers.BecomeAndroidSleepTrigger
import ru.dbotthepony.mc.otm.triggers.BecomeAndroidTrigger
import ru.dbotthepony.mc.otm.triggers.BecomeHumaneTrigger
import ru.dbotthepony.mc.otm.triggers.EnderTeleporterFallDeathTrigger
import ru.dbotthepony.mc.otm.triggers.FallDampenersSaveTrigger
import ru.dbotthepony.mc.otm.triggers.KillAsAndroidTrigger
import ru.dbotthepony.mc.otm.triggers.NanobotsArmorTrigger
import ru.dbotthepony.mc.otm.triggers.ShockwaveDamageMobTrigger
import ru.dbotthepony.mc.otm.triggers.ShockwaveTrigger
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 root = AdvancementBuilder()
@ -48,8 +48,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
announceChat = false,
background = modLocation("textures/block/decorative/metal_beam_top.png")
)
.addCriterion("became_android", BecomeAndroidTrigger.criterion)
.save(serializer, modLocation("android/root"))
.addCriterion("became_android", BecomeAndroidTrigger.Instance)
.save(serializer, modLocation("android/root"), existingFileHelper)
AdvancementBuilder()
.parent(root)
@ -62,10 +62,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Используйте модуль нулевой точки как внутренний источник питания. Теперь только вечность будет вашим злейшим врагом")
},
hidden = true,
frameType = AdvancementType.CHALLENGE
frameType = FrameType.CHALLENGE
)
.addCriterion("item", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.ZPM_BATTERY).build()).criterion())
.save(serializer, modLocation("android/zpm"))
.addCriterion("item", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.ZPM_BATTERY).build()))
.save(serializer, modLocation("android/zpm"), existingFileHelper)
AdvancementBuilder()
.parent(root)
@ -78,12 +78,12 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Используйте Квантовый Аккумулятор как внутренний источник питания, можно даже подключить другой конец к Реактору Распада")
},
hidden = true,
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.requirements(Strategy.OR)
.addCriterion("item0", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_BATTERY).build()).criterion())
.addCriterion("item1", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_CAPACITOR).build()).criterion())
.save(serializer, modLocation("android/quantum_battery"))
.requirements(RequirementsStrategy.OR)
.addCriterion("item0", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_BATTERY).build()))
.addCriterion("item1", AndroidBatteryTrigger.Instance(ItemPredicate.Builder.item().of(MItems.QUANTUM_CAPACITOR).build()))
.save(serializer, modLocation("android/quantum_battery"), existingFileHelper)
AdvancementBuilder()
.parent(root)
@ -97,8 +97,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
},
hidden = true,
)
.addCriterion("became_android", BecomeAndroidSleepTrigger.criterion)
.save(serializer, modLocation("android/become_thru_sleep"))
.addCriterion("became_android", BecomeAndroidSleepTrigger.Instance)
.save(serializer, modLocation("android/become_thru_sleep"), existingFileHelper)
AdvancementBuilder()
.parent(root)
@ -108,12 +108,12 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Изготовленный по старинке")
},
description = translation.add("death.desc", "In event of death, become an Android; Veteran's favorite") {
russian("Станьте андроидом, будучи умерев; Ветераны оценят")
russian("Будучи умерев, станьте андроидом; Ветераны оценят")
},
hidden = true,
)
.addCriterion("became_android", BecomeAndroidDeathTrigger.criterion)
.save(serializer, modLocation("android/become_thru_death"))
.addCriterion("became_android", BecomeAndroidDeathTrigger.Instance)
.save(serializer, modLocation("android/become_thru_death"), existingFileHelper)
AdvancementBuilder()
.parent(root)
@ -126,29 +126,43 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Вновь обретите плоть после своей жизни как набор гаек и болтов, но вот чего-то всё равно не хватает, что было при вас с самого начала...")
},
hidden = true,
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.addCriterion("become_humane", BecomeHumaneTrigger.criterion)
.save(serializer, modLocation("android/become_humane"))
.addCriterion("become_humane", BecomeHumaneTrigger.Instance)
.save(serializer, modLocation("android/become_humane"), existingFileHelper)
val attractor = AdvancementBuilder()
.parent(root)
.display(
itemStack = ItemStack(MItems.PHANTOM_ATTRACTOR),
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") {
russian("Создайте приманщик фантомов, для привлечения фантомов вновь, будучи андроидом")
},
)
.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()
.parent(root)
.display(
itemStack = ItemStack(MItems.ANDROID_STATION[null]!!),
itemStack = ItemStack(MItems.ANDROID_STATION),
title = translation.add("research_anything", "New Trick") {
russian("Новый фокус")
},
@ -156,8 +170,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте что либо за андроида")
},
)
.addCriterion("research_anything", AndroidResearchTrigger.Instance(Optional.empty(), Optional.empty()).criterion())
.save(serializer, modLocation("android/research_anything"))
.addCriterion("research_anything", AndroidResearchTrigger.Instance(null))
.save(serializer, modLocation("android/research_anything"), existingFileHelper)
AdvancementBuilder()
.parent(researchAnything)
@ -170,8 +184,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте воздушные мешки, дабы быть вновь поплавком в воде")
},
)
.addCriterion("air_bags", AndroidResearchTrigger.Instance(modLocation(MNames.AIR_BAGS)).criterion())
.save(serializer, modLocation("android/research_air_bags"))
.addCriterion("air_bags", AndroidResearchTrigger.Instance(modLocation(MNames.AIR_BAGS)))
.save(serializer, modLocation("android/research_air_bags"), existingFileHelper)
AdvancementBuilder()
.parent(researchAnything)
@ -184,8 +198,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте ночное зрение за андроида, дабы видеть во темноте")
},
)
.addCriterion("night_vision", AndroidResearchTrigger.Instance(modLocation(MNames.NIGHT_VISION)).criterion())
.save(serializer, modLocation("android/research_night_vision"))
.addCriterion("night_vision", AndroidResearchTrigger.Instance(modLocation(MNames.NIGHT_VISION)))
.save(serializer, modLocation("android/research_night_vision"), existingFileHelper)
val nanobots = AdvancementBuilder()
.parent(researchAnything)
@ -199,8 +213,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
},
hidden = true
)
.addCriterion("nanobots", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS)).criterion())
.save(serializer, modLocation("android/research_nanobots"))
.addCriterion("nanobots", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS)))
.save(serializer, modLocation("android/research_nanobots"), existingFileHelper)
val shielding = AdvancementBuilder()
.parent(nanobots)
@ -213,10 +227,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Дайте наноботам поглотить 5 сердец урона, не отключившись насовсем")
},
hidden = true,
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(10.0)).criterion())
.save(serializer, modLocation("android/nanobots_armor_deflect"))
.addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(10.0)))
.save(serializer, modLocation("android/nanobots_armor_deflect"), existingFileHelper)
AdvancementBuilder()
.parent(shielding)
@ -229,10 +243,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Дайте наноботам поглотить 10 сердец урона, не отключившись насовсем")
},
hidden = true,
frameType = AdvancementType.CHALLENGE
frameType = FrameType.CHALLENGE
)
.addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(20.0)).criterion())
.save(serializer, modLocation("android/nanobots_armor_deflect2"))
.addCriterion("damage", NanobotsArmorTrigger.Instance(Doubles.atLeast(20.0)))
.save(serializer, modLocation("android/nanobots_armor_deflect2"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Выживите после падения, которое было бы фатальным без поглотителей инерции")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.addCriterion("saved", FallDampenersSaveTrigger.criterion)
.save(serializer, modLocation("android/fall_dampeners_save"))
.addCriterion("saved", FallDampenersSaveTrigger.Instance)
.save(serializer, modLocation("android/fall_dampeners_save"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Разбейтесь насмерть через мгновения после телепортации за андроида")
},
frameType = AdvancementType.GOAL,
frameType = FrameType.GOAL,
hidden = true
)
.addCriterion("death", EnderTeleporterFallDeathTrigger.criterion)
.save(serializer, modLocation("android/ender_teleport_fall_death"))
.addCriterion("death", EnderTeleporterFallDeathTrigger.Instance)
.save(serializer, modLocation("android/ender_teleport_fall_death"), existingFileHelper)
val regen = AdvancementBuilder()
.parent(nanobots)
@ -276,8 +290,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Исследуйте регенерацию наноботов за андроида")
},
)
.addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)).criterion())
.save(serializer, modLocation("android/regen"))
.addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)))
.save(serializer, modLocation("android/regen"), existingFileHelper)
AdvancementBuilder()
.parent(regen)
@ -289,35 +303,35 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("regen_all.desc", "Max out Nanobots Regeneration research") {
russian("Полностью исследуйте регенерацию наноботов за андроида")
},
frameType = AdvancementType.GOAL,
frameType = FrameType.GOAL,
)
.addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)).criterion())
.addCriterion("regen1", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_2)).criterion())
.addCriterion("regen2", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_3)).criterion())
.addCriterion("regen3", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_4)).criterion())
.save(serializer, modLocation("android/regen_all"))
.addCriterion("regen0", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_1)))
.addCriterion("regen1", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_2)))
.addCriterion("regen2", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_3)))
.addCriterion("regen3", AndroidResearchTrigger.Instance(modLocation(MNames.NANOBOTS_REGENERATION_4)))
.save(serializer, modLocation("android/regen_all"), existingFileHelper)
AdvancementBuilder()
.parent(researchAnything)
.display(
itemStack = ItemStack(MItems.ANDROID_STATION[null]!!),
itemStack = ItemStack(MItems.ANDROID_STATION),
title = translation.add("research_all", "Mecha-Agnomination") {
russian("Меха-зумие")
},
description = translation.add("research_all.desc", "Research everything as Android (that don't block or get blocked by any other research)") {
russian("Исследуйте все технологии за андроида (которые не блокируют и не блокируются другими технологиями)")
},
frameType = AdvancementType.CHALLENGE
frameType = FrameType.CHALLENGE
)
.rewards(AdvancementRewards.Builder.experience(400).addLootTable(modLocation("research_all_android")))
.also { advancement ->
DataGen.researchProvider.generatedView.stream()
.filter { it.allBlockedBy.isEmpty() && it.allBlocking.isEmpty() }
.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()
.parent(researchAnything)
@ -330,8 +344,8 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Вызовите ударную волну при приземлении")
},
)
.addCriterion("shockwave", ShockwaveTrigger.criterion)
.save(serializer, modLocation("android/shockwave"))
.addCriterion("shockwave", ShockwaveTrigger.Instance)
.save(serializer, modLocation("android/shockwave"), existingFileHelper)
AdvancementBuilder()
.parent(shockwave)
@ -343,10 +357,10 @@ fun addAndroidAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
description = translation.add("shockwave_warden.desc", "Hurt Warden using Shockwave ability") {
russian("Нанесите хранителю урон используя ударную волну")
},
frameType = AdvancementType.GOAL
frameType = FrameType.GOAL
)
.addCriterion("shockwave_warden", ShockwaveDamageMobTrigger.Instance(Optional.of(EntityPredicate.Builder.entity().of(EntityType.WARDEN).build().wrap())).criterion())
.save(serializer, modLocation("android/shockwave_warden"))
.addCriterion("shockwave_warden", ShockwaveDamageMobTrigger.Instance(EntityPredicate.Builder.entity().of(EntityType.WARDEN).build().wrap()))
.save(serializer, modLocation("android/shockwave_warden"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Победите Иссушителя будучи андроидом. Наверняка Иссушитель был ошеломлён таким раскладом дел")
},
frameType = AdvancementType.GOAL,
frameType = FrameType.GOAL,
hidden = true
)
.addCriterion("kill_wither", KillAsAndroidTrigger.Instance(
predicate = Optional.of(EntityPredicate.Builder.entity().of(EntityType.WITHER).build().wrap()),
).criterion())
.save(serializer, modLocation("android/wither"))
predicate = EntityPredicate.Builder.entity().of(EntityType.WITHER).build().wrap(),
))
.save(serializer, modLocation("android/wither"), existingFileHelper)
val underwater = AdvancementBuilder()
.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...") {
russian("Преодолейте как минимум 200 метров под водой будучи андроидом без исследования воздушных мешков. Кого-то это нам напоминает...")
},
frameType = AdvancementType.GOAL,
frameType = FrameType.GOAL,
hidden = true
)
.addCriterion("travel", AndroidTravelUnderwater.Instance(200.0).criterion())
.save(serializer, modLocation("android/underwater"))
.addCriterion("travel", AndroidTravelUnderwater.Instance(200.0))
.save(serializer, modLocation("android/underwater"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Преодолейте как минимум 1046 метров под водой будучи андроидом без исследования воздушных мешков, прям как тот, кто так однажды так и сделал")
},
frameType = AdvancementType.CHALLENGE,
frameType = FrameType.CHALLENGE,
hidden = true
)
.addCriterion("travel", AndroidTravelUnderwater.Instance(1046.0).criterion())
.save(serializer, modLocation("android/underwater2"))
.addCriterion("travel", AndroidTravelUnderwater.Instance(1046.0))
.save(serializer, modLocation("android/underwater2"), existingFileHelper)
AdvancementBuilder()
.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") {
russian("Победите Древнего стража будучи андроидом без исследования воздушных мешков")
},
frameType = AdvancementType.CHALLENGE,
frameType = FrameType.CHALLENGE,
hidden = true
)
.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!!))
).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
import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.AdvancementRewards
import net.minecraft.advancements.AdvancementType
import net.minecraft.advancements.Criterion
import net.minecraft.advancements.CriterionTriggerInstance
import net.minecraft.advancements.DisplayInfo
import net.minecraft.advancements.FrameType
import net.minecraft.advancements.critereon.ContextAwarePredicate
import net.minecraft.advancements.critereon.EntityPredicate
import net.minecraft.advancements.critereon.InventoryChangeTrigger
import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.core.registries.Registries
import net.minecraft.network.chat.Component
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.ItemLike
import ru.dbotthepony.mc.otm.util.TextComponent
import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.function.Consumer
import ru.dbotthepony.mc.otm.core.TextComponent
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(
itemStack: ItemStack,
title: Component = TextComponent("undefined"),
description: Component = TextComponent("undefined"),
background: ResourceLocation? = null,
frameType: AdvancementType = AdvancementType.TASK,
frameType: FrameType = FrameType.TASK,
showToast: Boolean = true,
announceChat: Boolean = true,
hidden: Boolean = false,
@ -71,7 +47,7 @@ fun Advancement.Builder.display(
title: Component = TextComponent("undefined"),
description: Component = TextComponent("undefined"),
background: ResourceLocation? = null,
frameType: AdvancementType = AdvancementType.TASK,
frameType: FrameType = FrameType.TASK,
showToast: Boolean = true,
announceChat: Boolean = true,
hidden: Boolean = false,
@ -81,7 +57,7 @@ fun predicate(tag: TagKey<Item>): ItemPredicate {
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))
}
@ -89,7 +65,7 @@ fun predicate(item: ItemLike): ItemPredicate {
return ItemPredicate.Builder.item().of(item).build()
}
fun criterion(item: ItemLike): Criterion<*> {
fun criterion(item: ItemLike): CriterionTriggerInstance {
return InventoryChangeTrigger.TriggerInstance.hasItems(predicate(item))
}

View File

@ -1,76 +1,55 @@
package ru.dbotthepony.mc.otm.datagen.advancements
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.AdvancementRequirements
import net.minecraft.advancements.AdvancementType
import net.minecraft.advancements.critereon.ItemPredicate
import net.minecraft.advancements.Advancement
import net.minecraft.advancements.RequirementsStrategy
import net.minecraft.network.chat.contents.TranslatableContents
import net.minecraft.world.item.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import ru.dbotthepony.mc.otm.util.TranslatableComponent
import ru.dbotthepony.mc.otm.util.key
import ru.dbotthepony.mc.otm.util.registryName
import net.minecraftforge.common.data.ExistingFileHelper
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.core.key
import ru.dbotthepony.mc.otm.core.registryName
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.TakeItemOutOfReplicatorTrigger
import ru.dbotthepony.mc.otm.registry.MItemTags
import ru.dbotthepony.mc.otm.registry.MItems
import java.util.function.Consumer
data class CraftEntry(
val item: Collection<Item>,
private data class CraftEntry(
val item: Item,
val englishName: String,
val englishSuffix: String? = null,
val russianName: 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 {
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) {
fun addMachineAdvancements(serializer: Consumer<Advancement>, existingFileHelper: ExistingFileHelper, lang: MatteryLanguageProvider) {
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()
.parent(root)
.display(
itemStack = ItemStack(MItems.CHEMICAL_GENERATOR[null]!!),
itemStack = ItemStack(MItems.CHEMICAL_GENERATOR),
title = translation.add("chemical_generator", "Burning the Organics") {
russian("Сжигание органики")
},
@ -78,17 +57,13 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Создайте химический генератор. Лучше установить его снаружи")
},
)
.also {
for ((i, v) in MItems.CHEMICAL_GENERATOR.values.withIndex())
it.addCriterion("has_machine_$i", criterion(v))
}
.requirements(AdvancementRequirements.Strategy.OR)
.save(serializer, modLocation("machines/chemical_generator"))
.addCriterion("has_machine", criterion(MItems.CHEMICAL_GENERATOR))
.save(serializer, modLocation("machines/chemical_generator"), existingFileHelper)
val press = AdvancementBuilder()
.parent(chem)
.display(
itemStack = ItemStack(MItems.TWIN_PLATE_PRESS[null]!!),
itemStack = ItemStack(MItems.PLATE_PRESS),
title = translation.add("plate_press", "Bending the Material") {
russian("Раскатка металла")
},
@ -96,147 +71,58 @@ fun addMachineAdvancements(serializer: Consumer<AdvancementHolder>, lang: Matter
russian("Создайте пресс пластин, не суйте свои или чужие конечности внутрь")
},
)
.also {
for ((i, m) in MItems.TWIN_PLATE_PRESS.values.withIndex())
it.addCriterion(i.toString(), criterion(m))
}
.requirements(AdvancementRequirements.Strategy.OR)
.save(serializer, modLocation("machines/plate_press"))
.addCriterion("has_machine", criterion(MItems.PLATE_PRESS))
.save(serializer, modLocation("machines/plate_press"), existingFileHelper)
CraftEntry(
MItems.ENERGY_SERVO.values, "Power Goes In, Powered Things Go Out",
russianName = "Энергия на вход, электроинструмент на выход").make(serializer, press, translation)
val entries = listOf(
CraftEntry(MItems.MATTER_SCANNER, "Scanning Things that Matter",
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(
MItems.MATTER_SCANNER.values, "Scanning Things that Matter",
russianName = "Сканируем вещи которые материальны")
val decomposer = CraftEntry(
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 = "Модульный бак материи")
CraftEntry(MItems.ENERGY_COUNTER, "Visualize Power Burn",
russianName = "Визуализация сжигания энергии"),
CraftEntry(MItems.BATTERY_BANK, "Batteries Not Included", "By all means avoid the urge to hammer incompatible batteries into the power bus.",
russianName = "Батарейки в комплект не входят", russianSuffix = "Пожалуйста, воздержитесь от вбивания кувалдой несовместимых батарей в энергетическую шину."),
)
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 built = mutableMapOf<Item, Advancement>()
val pattern = CraftEntry(
MItems.PATTERN_STORAGE, "Digital Knowledge Library",
russianName = "Цифровая библиотека знаний")
for (entry in entries) {
val path = entry.item.registryName!!.path
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()
.parent(it)
.display(
hidden = true,
itemStack = ItemStack(MItems.MATTER_DUST),
title = translation.add("replicate_failure", "Unhealthy Flavor") {
russian("Вредная посыпка")
},
description = translation.add("replicate_failure.desc", "Experience replication failure and have your thing turn into matter dust") {
russian("Наблюдайте неудачный результат репликации, где ваш заказ рассыпался в материальную труху")
},
)
.addCriterion("replicate_failure", TakeItemOutOfReplicatorTrigger.Instance(ItemPredicate.Builder.item().of(
MItems.MATTER_DUST).build()).criterion())
.save(serializer, modLocation("machines/replicate_failure"))
}
reconstructor.make(serializer, it, translation)
val translated = translation.add("$path.desc", "Craft a %s%s") {
russian("Создайте %s%s")
}
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)
val translatedSuffix = translation.add("$path.suffix", if (entry.englishSuffix != null) ". " + entry.englishSuffix else "") {
russian(if (entry.russianSuffix != null) ". " + entry.russianSuffix else "")
}
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)
built[entry.item] = AdvancementBuilder()
.parent(press)
.display(
itemStack = ItemStack(entry.item),
title = translation.add(path, entry.englishName) {
if (entry.russianName != null) {
russian(entry.russianName)
}
},
description = TranslatableComponent(translated.contents.key, entry.item.description, translatedSuffix),
)
.addCriterion("has_machine", criterion(entry.item))
.save(serializer, modLocation("machines/$path"), existingFileHelper)
}
}

View File

@ -1,16 +1,15 @@
package ru.dbotthepony.mc.otm.datagen.blocks
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.Block
import net.neoforged.neoforge.client.model.generators.BlockStateProvider
import net.neoforged.neoforge.client.model.generators.ConfiguredModel
import net.neoforged.neoforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.util.get
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth
import net.minecraftforge.client.model.generators.BlockStateProvider
import net.minecraftforge.client.model.generators.ConfiguredModel
import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.core.get
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.datagen.DataGen
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 {
if (input == 0)
@ -19,35 +18,35 @@ private fun nothingOrNumber(input: Int): String {
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 batteryPath = "block/battery/battery"
protected var registry: Block = MBlocks.BATTERY_BANK[color]!!
protected var registry: Block = MBlocks.BATTERY_BANK
override fun registerStatesAndModels() {
with(getVariantBuilder(registry)) {
forAllStates {
ConfiguredModel.builder()
.modelFile(models().getExistingFile(modLocation("block/$block${if (color != null) "_${color.name.lowercase()}" else ""}")))
.rotationY(it[BlockRotationFreedom.HORIZONTAL.property].front.yRotationBlockstateNorth())
.modelFile(models().getExistingFile(modLocation("block/$block")))
.rotationY(it[BlockRotationFreedom.ONE.property].front.yRotationBlockstateNorth())
.build()
}
}
}
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 {
block = "matter_capacitor_bank"
batteryPath = "block/battery/matter_capacitor"
registry = MBlocks.MATTER_CAPACITOR_BANK[color]!!
registry = MBlocks.MATTER_CAPACITOR_BANK
}
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.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.decorative.CargoCrateBlock
import ru.dbotthepony.mc.otm.block.entity.WorkerState
import ru.dbotthepony.mc.otm.block.matter.MatterBottlerBlock
import ru.dbotthepony.mc.otm.block.tech.AndroidChargerBlock
import ru.dbotthepony.mc.otm.block.tech.EssenceStorageBlock
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.util.get
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.xRotationBlockstateNorth
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.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateSouth
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateSouth
import ru.dbotthepony.mc.otm.core.registryName
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.MRegistry
import java.util.ArrayList
fun addBlockStates(provider: MatteryBlockStateProvider) {
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.TRITANIUM_ORE)
provider.ore(MBlocks.TRITANIUM_RAW_BLOCK)
provider.block(MBlocks.TRITANIUM_INGOT_BLOCK)
provider.block(MBlocks.METAL_MESH)
provider.block(MBlocks.WITHERED_STEEL_BLOCK)
provider.exec {
provider.getVariantBuilder(MBlocks.ROFLITE_ALLOY_BLOCK).forAllStates {
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.CHEMICAL_GENERATOR)
provider.block(MBlocks.MATTER_SCANNER)
provider.block(MBlocks.ITEM_MONITOR)
provider.block(MBlocks.HOLO_SIGN)
provider.exec {
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}")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockStateProperties.DOUBLE_BLOCK_HALF, DoubleBlockHalf.LOWER)
.condition(BlockRotationFreedom.HORIZONTAL.property, dir)
.condition(BlockRotationFreedom.ONE.property, dir)
.end()
}
}
for (block in MBlocks.ANDROID_CHARGER.values) {
with(provider.getMultipartBuilder(block)) {
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()
}
with(provider.getMultipartBuilder(MBlocks.MATTER_BOTTLER)) {
for (dir in BlockRotationFreedom.ONE.possibleValues) {
for (enum in WorkerState.SEMI_WORKER_STATE.possibleValues) {
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.ONE.property, dir)
.condition(WorkerState.WORKER_STATE, enum)
.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) {
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name.lowercase()}")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, dir)
.condition(WorkerState.WORKER_STATE, enum)
.end()
}
}
for (dir in BlockRotationFreedom.ONE.possibleValues) {
for (enum in MatterBottlerBlock.SLOT_PROPERTIES) {
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_open")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.ONE.property, dir)
.condition(enum, false)
.end()
for (dir in BlockRotationFreedom.HORIZONTAL.possibleValues) {
for (enum in MatterBottlerBlock.SLOT_PROPERTIES) {
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_open")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, dir)
.condition(enum, false)
.end()
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_closed")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, dir)
.condition(enum, true)
.end()
}
part().modelFile(provider.models().getExistingFile(modLocation("matter_bottler_${enum.name}_closed")))
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.ONE.property, dir)
.condition(enum, true)
.end()
}
}
}
}
provider.block(MBlocks.MATTER_DECOMPOSER.values)
provider.block(MBlocks.MATTER_REPLICATOR.values)
provider.block(MBlocks.MATTER_ENTANGLER)
provider.block(MBlocks.PLATE_PRESS.values)
provider.block(MBlocks.TWIN_PLATE_PRESS.values)
provider.block(MBlocks.MATTER_DECOMPOSER)
provider.block(MBlocks.MATTER_REPLICATOR)
provider.block(MBlocks.PLATE_PRESS)
provider.block(MBlocks.GRAVITATION_STABILIZER)
provider.block(MBlocks.GRAVITATION_STABILIZER_LENS)
provider.block(MBlocks.POWERED_BLAST_FURNACE.values)
provider.block(MBlocks.POWERED_FURNACE.values)
provider.block(MBlocks.POWERED_SMOKER.values)
provider.block(MBlocks.STORAGE_POWER_SUPPLIER.values)
provider.block(MBlocks.MATTER_PANEL.values)
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.block(MBlocks.STORAGE_POWER_SUPPLIER)
provider.block(MBlocks.MATTER_RECYCLER)
provider.block(MBlocks.MATTER_RECONSTRUCTOR)
provider.block(MBlocks.ENERGY_SERVO)
provider.block(MBlocks.COBBLESTONE_GENERATOR)
provider.block(MBlocks.ESSENCE_STORAGE)
provider.exec {
for (crate in MRegistry.CARGO_CRATES.allBlocks.values) {
@ -188,19 +99,19 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
modLocation("${crate.registryName!!.path}_${if (it.getValue(
CargoCrateBlock.IS_OPEN)) "open" else "closed"}")
))
.rotationY(it.getValue(BlockRotationFreedom.HORIZONTAL.property).front.yRotationBlockstateNorth())
.rotationY(it.getValue(BlockRotationFreedom.ONE.property).front.yRotationBlockstateNorth())
.buildLast()
)
}
}
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")))
.rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.DIRECTIONAL.property, dir)
.condition(BlockRotationFreedom.TWO.property, dir)
.end()
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
@ -216,12 +127,12 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
}
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")))
.rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.DIRECTIONAL.property, dir)
.condition(BlockRotationFreedom.TWO.property, dir)
.end()
part().modelFile(provider.models().getExistingFile(modLocation("storage_cable_connection")))
@ -237,12 +148,12 @@ fun addBlockStates(provider: MatteryBlockStateProvider) {
}
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")))
.rotationX(dir.front.xRotationBlockstateNorth())
.rotationY(dir.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.DIRECTIONAL.property, dir)
.condition(BlockRotationFreedom.TWO.property, dir)
.end()
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")))
.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,97 +5,91 @@ import ru.dbotthepony.mc.otm.block.tech.EnergyCounterBlock
import ru.dbotthepony.mc.otm.block.entity.WorkerState
import ru.dbotthepony.mc.otm.block.matter.PatternStorageBlock
import ru.dbotthepony.mc.otm.block.storage.DriveViewerBlock
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
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) {
for (block in MBlocks.DRIVE_VIEWER.values) {
with(provider.getMultipartBuilder(block)) {
for (facing in BlockRotationFreedom.HORIZONTAL.possibleValues) {
with(provider.getMultipartBuilder(MBlocks.DRIVE_VIEWER)) {
for (facing in BlockRotationFreedom.ONE.possibleValues) {
part()
.modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_drive_part")))
.rotationY(facing.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.ONE.property, facing)
.condition(DriveViewerBlock.DRIVE_PRESENT, true)
for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) {
part()
.modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_drive_part")))
.modelFile(provider.models().getExistingFile(modLocation("block/drive_viewer_${workState.name.lowercase()}")))
.rotationY(facing.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, facing)
.condition(DriveViewerBlock.DRIVE_PRESENT, true)
for (workState in WorkerState.SEMI_WORKER_STATE.possibleValues) {
part()
.modelFile(provider.models().getExistingFile(modLocation("block/${block.registryName!!.path}_${workState.name.lowercase()}")))
.rotationY(facing.front.yRotationBlockstateNorth())
.addModel()
.condition(WorkerState.SEMI_WORKER_STATE, workState)
.condition(BlockRotationFreedom.HORIZONTAL.property, facing)
}
.condition(WorkerState.SEMI_WORKER_STATE, workState)
.condition(BlockRotationFreedom.ONE.property, facing)
}
}
}
with(provider.getMultipartBuilder(MBlocks.PATTERN_STORAGE)) {
for (facing in BlockRotationFreedom.HORIZONTAL.possibleValues) {
for (facing in BlockRotationFreedom.ONE.possibleValues) {
part()
.modelFile(provider.models().getExistingFile(modLocation("block/pattern_storage")))
.rotationY(facing.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, facing)
.condition(BlockRotationFreedom.ONE.property, facing)
for (i in 0 .. 7) {
part()
.modelFile(provider.models().getExistingFile(modLocation("block/pattern/model$i")))
.rotationY(facing.front.yRotationBlockstateNorth())
.addModel()
.condition(BlockRotationFreedom.HORIZONTAL.property, facing)
.condition(BlockRotationFreedom.ONE.property, facing)
.condition(PatternStorageBlock.PATTERN_STORAGE_DISKS_PROPS[i], true)
}
}
}
for ((dye, block) in 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 down = provider.models().getExistingFile(modLocation("block/energy_counter_down$dyeName"))
val west = provider.models().getExistingFile(modLocation("block/energy_counter_west$dyeName"))
val east = provider.models().getExistingFile(modLocation("block/energy_counter_east$dyeName"))
with(provider.getMultipartBuilder(MBlocks.ENERGY_COUNTER)) {
// даваааййй
val up = provider.models().getExistingFile(modLocation("block/energy_counter_up"))
val down = provider.models().getExistingFile(modLocation("block/energy_counter_down"))
val west = provider.models().getExistingFile(modLocation("block/energy_counter_west"))
val east = provider.models().getExistingFile(modLocation("block/energy_counter_east"))
// ДАААА ДАВАЙЙ ДАААВАААЙЙЙЙЙЙ
val north = provider.models().getExistingFile(modLocation("block/energy_counter_north$dyeName"))
val northDown = provider.models().getExistingFile(modLocation("block/energy_counter_north_down$dyeName"))
val northEast = provider.models().getExistingFile(modLocation("block/energy_counter_north_east$dyeName"))
val northWest = provider.models().getExistingFile(modLocation("block/energy_counter_north_west$dyeName"))
val south = provider.models().getExistingFile(modLocation("block/energy_counter_south$dyeName"))
val southDown = provider.models().getExistingFile(modLocation("block/energy_counter_south_down$dyeName"))
val southEast = provider.models().getExistingFile(modLocation("block/energy_counter_south_east$dyeName"))
val southWest = provider.models().getExistingFile(modLocation("block/energy_counter_south_west$dyeName"))
// ДАААА ДАВАЙЙ ДАААВАААЙЙЙЙЙЙ
val north = provider.models().getExistingFile(modLocation("block/energy_counter_north"))
val northDown = provider.models().getExistingFile(modLocation("block/energy_counter_north_down"))
val northEast = provider.models().getExistingFile(modLocation("block/energy_counter_north_east"))
val northWest = provider.models().getExistingFile(modLocation("block/energy_counter_north_west"))
val south = provider.models().getExistingFile(modLocation("block/energy_counter_south"))
val southDown = provider.models().getExistingFile(modLocation("block/energy_counter_south_down"))
val southEast = provider.models().getExistingFile(modLocation("block/energy_counter_south_east"))
val southWest = provider.models().getExistingFile(modLocation("block/energy_counter_south_west"))
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(up).rotationY(dir.yRotationBlockstateNorth()).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.DOWN).condition(EnergyCounterBlock.IF_DIRECTION, dir)
}
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(up).rotationY(dir.yRotationBlockstateNorth()).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.DOWN).condition(EnergyCounterBlock.IF_DIRECTION, dir)
}
// низкий поклон за полностью рабочий поворот вокруг оси Z
part().modelFile(north).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.UP)
part().modelFile(northDown).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.DOWN)
part().modelFile(northEast).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.EAST)
part().modelFile(northWest).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.WEST)
// низкий поклон за полностью рабочий поворот вокруг оси Z
part().modelFile(north).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.UP)
part().modelFile(northDown).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.DOWN)
part().modelFile(northEast).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.EAST)
part().modelFile(northWest).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.NORTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.WEST)
part().modelFile(south).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.UP)
part().modelFile(southDown).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.DOWN)
part().modelFile(southEast).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.EAST)
part().modelFile(southWest).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.WEST)
part().modelFile(south).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.UP)
part().modelFile(southDown).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.DOWN)
part().modelFile(southEast).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.EAST)
part().modelFile(southWest).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, Direction.SOUTH).condition(EnergyCounterBlock.IF_DIRECTION, Direction.WEST)
for (dir in arrayOf(Direction.WEST, Direction.EAST)) {
val mdl = if (dir === Direction.WEST) west else east
for (dir in arrayOf(Direction.WEST, Direction.EAST)) {
val mdl = if (dir === Direction.WEST) west else east
part().modelFile(mdl).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.NORTH)
part().modelFile(mdl).rotationX(-90).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.UP)
part().modelFile(mdl).rotationX(180).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.SOUTH)
part().modelFile(mdl).rotationX(90).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.DOWN)
}
part().modelFile(mdl).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.NORTH)
part().modelFile(mdl).rotationX(-90).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.UP)
part().modelFile(mdl).rotationX(180).addModel().condition(EnergyCounterBlock.INPUT_DIRECTION, dir).condition(EnergyCounterBlock.IF_DIRECTION, Direction.SOUTH)
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
import net.minecraft.core.Direction
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.RotatedPillarBlock
import net.minecraft.world.level.block.state.BlockState
import net.neoforged.neoforge.client.model.generators.BlockStateProvider
import net.neoforged.neoforge.client.model.generators.ConfiguredModel
import net.neoforged.neoforge.data.event.GatherDataEvent
import net.minecraftforge.client.model.generators.BlockStateProvider
import net.minecraftforge.client.model.generators.ConfiguredModel
import net.minecraftforge.data.event.GatherDataEvent
import ru.dbotthepony.mc.otm.block.entity.WorkerState
import ru.dbotthepony.mc.otm.util.getValueNullable
import ru.dbotthepony.mc.otm.util.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.util.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.util.registryName
import ru.dbotthepony.mc.otm.core.getValueNullable
import ru.dbotthepony.mc.otm.core.math.BlockRotationFreedom
import ru.dbotthepony.mc.otm.core.math.xRotationBlockstateNorth
import ru.dbotthepony.mc.otm.core.math.yRotationBlockstateNorth
import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import java.util.*
import java.util.LinkedList
typealias BlockStateTransform = (state: BlockState, builder: ConfiguredModel.Builder<*>, path: String) -> String?
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 {
@Suppress("NAME_SHADOWING") var modelPath = modelPath
it.getValueNullable(BlockRotationFreedom.HORIZONTAL.property)?.let {
it.getValueNullable(BlockRotationFreedom.ONE.property)?.let {
builder.rotationY(it.front.yRotationBlockstateNorth())
}
it.getValueNullable(BlockRotationFreedom.DIRECTIONAL.property)?.let {
it.getValueNullable(BlockRotationFreedom.TWO.property)?.let {
builder.rotationY(it.front.yRotationBlockstateNorth())
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.rotationX(it.front.xRotationBlockstateNorth())
}
@ -57,10 +54,10 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
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 {
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
builder.modelFile(models().getExistingFile(modLocation(modelPath)))
@ -71,7 +68,7 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
fun block(blocks: Collection<Block>): MatteryBlockStateProvider {
for (block in blocks) {
this.block(block)
this.block(block, EMPTY)
}
return this
@ -79,40 +76,19 @@ class MatteryBlockStateProvider(event: GatherDataEvent) : BlockStateProvider(eve
fun block(vararg blocks: Block): MatteryBlockStateProvider {
for (block in blocks) {
block(block)
this.block(block, EMPTY)
}
return this
}
fun simpleBlockM(vararg blocks: Block): MatteryBlockStateProvider {
for (block in blocks) {
simpleBlockM(block)
}
return this
}
fun simpleBlockM(block: Block, model: ResourceLocation = checkNotNull(block.registryName) {"$block registry name is null!"}): MatteryBlockStateProvider {
exec {
getVariantBuilder(block).forAllStates {
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(model)))
}
}
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()
getVariantBuilder(block).forAllStates {
check(block.registryName != null) {"$block registry name is null!"}
return@forAllStates arrayOf(ConfiguredModel(models().getExistingFile(block.registryName)))
}
}
}

View File

@ -1,16 +1,15 @@
package ru.dbotthepony.mc.otm.datagen.items
import net.minecraft.world.item.DyeColor
import ru.dbotthepony.mc.otm.util.ResourceLocation
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.registry.game.MItems
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
fun addItemModels(provider: MatteryItemModelProvider) {
provider.coloredWithBaseBlock(MItems.ANDROID_STATION, "android_station", "_working")
provider.coloredWithBaseBlock(MItems.BATTERY_BANK, "matter_capacitor_bank")
provider.coloredWithBaseBlock(MItems.MATTER_CAPACITOR_BANK, "matter_capacitor_bank")
provider.block(MItems.ANDROID_STATION, "android_station_working")
provider.block(MItems.BATTERY_BANK)
provider.block(MItems.MATTER_CAPACITOR_BANK)
provider.block(MItems.PATTERN_STORAGE)
provider.exec {
@ -21,36 +20,23 @@ fun addItemModels(provider: MatteryItemModelProvider) {
}
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.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.TRITANIUM_ORE)
provider.block(MItems.TRITANIUM_STRIPED_BLOCK)
provider.block(MItems.TRITANIUM_RAW_BLOCK)
provider.block(MItems.TRITANIUM_INGOT_BLOCK)
provider.block(MItems.WITHERED_STEEL_BLOCK)
provider.block(MItems.ROFLITE_ALLOY_BLOCK)
provider.block(MItems.DILITHIUM_ORE)
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"))
provider.block(MItems.ITEM_MONITOR)
provider.block(MItems.PHANTOM_ATTRACTOR)
provider.block(MItems.HOLO_SIGN)
provider.generated(MItems.FLUID_CAPSULE)
provider.block(MItems.FLUID_TANK)
MRegistry.VENT.allItems.values.forEach(provider::block)
MRegistry.VENT_ALTERNATIVE.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)
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_OBLIVION)
provider.generated(MItems.PILL_HEAL)
provider.generated(MItems.PILL_NOT_NORMAL)
provider.generated(MItems.NUTRIENT_PASTE)
provider.generated(MItems.IMPERFECT_BREAD)
provider.generated(MItems.REDSTONE_INTERACTOR)
provider.generated(MItems.ESSENCE_DRIVE)
provider.generated(MItems.ESSENCE_CAPSULE)
@ -94,112 +77,33 @@ fun addItemModels(provider: MatteryItemModelProvider) {
provider.generated(MItems.ExopackUpgrades.INVENTORY_UPGRADE_CREATIVE)
provider.generated(MItems.ExopackUpgrades.CRAFTING_UPGRADE)
provider.generated(MItems.ExopackUpgrades.SMELTING_UPGRADE)
provider.generated(MItems.ExopackUpgrades.ENDER_UPGRADE)
provider.resource(MItems.TRITANIUM_DUST)
provider.resource(MItems.TRITANIUM_INGOT)
provider.resource(MItems.TRITANIUM_NUGGET)
provider.component(MItems.TRITANIUM_DUST)
provider.component(MItems.TRITANIUM_INGOT)
provider.component(MItems.TRITANIUM_NUGGET)
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.handheld(MItems.TRITANIUM_TOOLS)
provider.armorColored(MItems.TRITANIUM_ARMOR)
provider.armorWithTrims(MItems.SIMPLE_TRITANIUM_ARMOR)
provider.generated(MItems.TRITANIUM_ARMOR)
provider.generated(MItems.SIMPLE_TRITANIUM_ARMOR)
provider.handheld(MItems.CHEST_UPGRADER)
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.generatedTiered(MItems.BATTERIES, "battery_tier")
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.capacitorWithGauge(MItems.MATTER_CAPACITOR_NORMAL, 8, "matter_capacitor_gauge_", 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_BASIC, modLocation("item/matter_capacitor_tier1"))
provider.generated(MItems.MATTER_CAPACITOR_NORMAL, modLocation("item/matter_capacitor_tier2"))
provider.generated(MItems.MATTER_CAPACITOR_DENSE, modLocation("item/matter_capacitor_tier3"))
provider.generated(MItems.MATTER_CAPACITOR_CREATIVE)
provider.generated(MItems.MachineUpgrades.Basic.BLANK, modLocation("item/machine_upgrade_tier1"))
provider.upgrade(MItems.MachineUpgrades.Basic.SPEED, "speed", "tier1")
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)
provider.generated(MItems.QUANTUM_CAPACITOR)
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_CREATIVE2)
provider.withExistingParent(MItems.GOLD_DISK, MItems.PATTERN_DRIVE_CREATIVE.registryName!!)
provider.generated(MItems.MATTER_DUST)
provider.generated(MItems.TRITANIUM_DOOR.values)
@ -207,88 +111,36 @@ fun addItemModels(provider: MatteryItemModelProvider) {
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")
for (item in MRegistry.CARGO_CRATES.allItems.values)
for (item in MRegistry.CARGO_CRATES.allItems.values) {
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.exec {
provider.withExistingParent("android_charger_${dye.name.lowercase()}", modLocation("item/android_charger")).texture("0", modLocation("block/android_charger/${dye.name.lowercase()}"))
provider.withExistingParent("matter_panel_${dye.name.lowercase()}", modLocation("item/matter_panel")).texture("texture", modLocation("block/matter_panel/${dye.name.lowercase()}"))
provider.withExistingParent("essence_storage_${dye.name.lowercase()}", modLocation("block/essence_storage_${dye.name.lowercase()}_empty"))
.override()
.predicate(modLocation("is_filled"), 1f)
.model(provider.withExistingParent("essence_storage_${dye.name.lowercase()}_filled", modLocation("block/essence_storage_${dye.name.lowercase()}_filled")))
.end()
}
}
provider.block(MItems.CHEMICAL_GENERATOR, "chemical_generator_working")
provider.block(MItems.ENERGY_COUNTER, "energy_counter_down")
provider.block(MItems.MATTER_BOTTLER, "matter_bottler_working")
provider.block(MItems.MATTER_CABLE, "matter_cable_core")
provider.block(MItems.MATTER_DECOMPOSER, "matter_decomposer_working")
provider.block(MItems.ENERGY_SERVO, "energy_servo")
provider.block(MItems.ESSENCE_STORAGE, "essence_storage")
provider.block(MItems.MATTER_RECONSTRUCTOR, "matter_reconstructor")
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_IMPORTER)
provider.block(MItems.STORAGE_EXPORTER)
provider.block(MItems.FLYWHEEL_HOUSING)
provider.block(MItems.FLYWHEEL_BEARING)
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 (item in MItems.TRITANIUM_ANVIL) {
provider.block(item)
}
for ((color, item) in MItems.CARGO_CRATE_MINECARTS) {
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
import net.minecraft.data.models.ItemModelGenerators
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.neoforged.neoforge.client.model.generators.ItemModelProvider
import net.neoforged.neoforge.data.event.GatherDataEvent
import net.minecraftforge.client.model.generators.ItemModelProvider
import net.minecraftforge.data.event.GatherDataEvent
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.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
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, 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(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 {
val ARMOR_TRIM_MATERIALS = listOf("quartz", "iron", "netherite", "redstone", "copper", "gold", "emerald", "diamond", "lapis", "amethyst")
val GENERATED = ResourceLocation("minecraft", "item/generated")
val HANDHELD = ResourceLocation("minecraft", "item/handheld")
private val LOGGER = LogManager.getLogger()

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,6 @@
package ru.dbotthepony.mc.otm.datagen.lang
import com.google.common.collect.ImmutableList
import com.google.common.collect.ImmutableMap
import it.unimi.dsi.fastutil.objects.Object2ObjectArrayMap
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.Item
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.enchantment.Enchantment
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.player.android.AndroidFeatureType
import ru.dbotthepony.mc.otm.player.android.AndroidResearchType
import ru.dbotthepony.mc.otm.util.TranslatableComponent
import ru.dbotthepony.mc.otm.datagen.DataGen
import ru.dbotthepony.mc.otm.android.AndroidFeatureType
import ru.dbotthepony.mc.otm.android.AndroidResearch
import ru.dbotthepony.mc.otm.android.AndroidResearchType
import ru.dbotthepony.mc.otm.core.TranslatableComponent
import ru.dbotthepony.mc.otm.registry.objects.ColoredDecorativeBlock
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: 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 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 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: 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: 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: 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) {
val path = "$path."
constructor(vararg path: String) : this(path.joinToString("."))
@ -123,7 +118,6 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
inner class Colors(
language: String,
val lowercaseIntermediate: Boolean,
val white: String,
val orange: String,
@ -144,7 +138,86 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
) {
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.ORANGE, orange)
.put(DyeColor.MAGENTA, magenta)
@ -163,30 +236,37 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
.put(DyeColor.BLACK, black)
.build()
fun add(list: ColoredDecorativeBlock<*>, toFormat: String) {
for ((color, target) in mapped) {
val dyeClassPairs: List<Pair<DyeColor, String>> = ImmutableList.builder<Pair<DyeColor, String>>()
.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))
}
}
fun forEach(consumer: (color: DyeColor, name: String) -> Unit) {
for ((a, b) in mapped) {
for ((a, b) in dyeClassPairs) {
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(
whiteBlock: Block,
orangeBlock: Block,
@ -262,9 +342,55 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
slave.add(redItem, toFormat.format(red))
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
)
}
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", lowercaseIntermediate = false,
val englishColors = Colors("en_us",
"White",
"Orange",
"Magenta",
@ -283,18 +409,18 @@ class MatteryLanguageProvider(private val gen: DataGenerator) {
"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
import net.minecraft.data.DataGenerator
import net.minecraft.world.item.ItemStack
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.neoforged.neoforge.common.data.GlobalLootModifierProvider
import net.neoforged.neoforge.data.event.GatherDataEvent
import net.minecraftforge.common.data.GlobalLootModifierProvider
import ru.dbotthepony.mc.otm.data.loot.LootPoolAppender
import ru.dbotthepony.mc.otm.datagen.DataGen
import java.util.Arrays
@ -51,7 +51,7 @@ fun PlainLootAppender(
vararg items: Pair<ItemStack, Double>
) = 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>()
fun lambda(lambda: (LootModifiers) -> Unit) {

View File

@ -1,30 +1,23 @@
package ru.dbotthepony.mc.otm.datagen.loot
import net.minecraft.resources.ResourceKey
import net.minecraft.resources.ResourceLocation
import net.minecraft.util.valueproviders.UniformInt
import net.minecraft.world.entity.EntityType
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.LootTable
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition
import net.neoforged.neoforge.common.loot.AddTableLootModifier
import net.neoforged.neoforge.common.loot.LootTableIdCondition
import ru.dbotthepony.mc.otm.util.ResourceLocation
import ru.dbotthepony.mc.otm.util.math.Decimal
import ru.dbotthepony.mc.otm.data.world.UniformDecimal
import net.minecraftforge.common.loot.LootTableIdCondition
import ru.dbotthepony.mc.otm.core.math.Decimal
import ru.dbotthepony.mc.otm.data.UniformDecimal
import ru.dbotthepony.mc.otm.data.condition.ChanceWithPlaytimeCondition
import ru.dbotthepony.mc.otm.data.condition.HasExoPackCondition
import ru.dbotthepony.mc.otm.data.condition.ItemInInventoryCondition
import ru.dbotthepony.mc.otm.data.condition.KilledByRealPlayerOrIndirectly
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.exopack.ProceduralExopackSlotUpgradeItem
import ru.dbotthepony.mc.otm.item.matter.GoldDiskItem
import ru.dbotthepony.mc.otm.registry.game.MItems
import ru.dbotthepony.mc.otm.item.exopack.ProceduralExoPackSlotUpgradeItem
import ru.dbotthepony.mc.otm.registry.MItems
@Suppress("FunctionName")
fun LootTableIdCondition(location: String): LootItemCondition {
@ -36,23 +29,18 @@ fun LootTableIdCondition(location: ResourceLocation): LootItemCondition {
return LootTableIdCondition.Builder(location).build()
}
@Suppress("FunctionName")
fun LootTableIdCondition(location: ResourceKey<LootTable>): LootItemCondition {
return LootTableIdCondition.Builder(location.location()).build()
}
fun addLootModifiers(it: LootModifiers) {
it.add("dungeon_exopack", LootPoolAppender(
arrayOf(LootTableIdCondition(BuiltInLootTables.SIMPLE_DUNGEON)),
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.2)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(6, 9)))
apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(6, 9)))
},
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
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) {
chanceCondition(0.1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(4, 8)))
apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(4, 8)))
},
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(4, 10)))
},
singleItem(MItems.GOLD_DISK) {
chanceCondition(0.1)
apply(GoldDiskItem.patterns(DataGen.random, MItems.IMPERFECT_BREAD))
apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(4, 10)))
},
singleItem(MItems.PROCEDURAL_BATTERY) {
@ -90,12 +73,12 @@ fun addLootModifiers(it: LootModifiers) {
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
chanceCondition(0.1)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(12, 18)))
apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(12, 18)))
},
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
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) {
chanceCondition(0.15)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18)))
apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18)))
},
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
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) {
chanceCondition(0.4)
apply(ProceduralExopackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18)))
apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(9, 18)))
},
singleItem(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL) {
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) {
chanceCondition(0.1)
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))
apply(ProceduralExoPackSlotUpgradeItem.Randomizer(UniformInt.of(27, 56), UniformInt.of(2, 6)))
},
))
@ -142,7 +120,6 @@ fun addLootModifiers(it: LootModifiers) {
ItemStack(MItems.PILL_ANDROID, 1) to 0.1,
ItemStack(MItems.PILL_HEAL, 2) to 0.5,
ItemStack(MItems.PILL_HEAL, 1) to 0.75,
ItemStack(MItems.PILL_NOT_NORMAL, 3) to 0.25,
))
it.add("mineshaft_pill", PlainLootAppender(
@ -150,7 +127,6 @@ fun addLootModifiers(it: LootModifiers) {
ItemStack(MItems.PILL_ANDROID, 1) to 0.04,
ItemStack(MItems.PILL_HEAL, 2) to 0.1,
ItemStack(MItems.PILL_HEAL, 1) to 0.4,
ItemStack(MItems.PILL_NOT_NORMAL, 3) to 0.25,
))
it.add("mineshaft_nutrient_paste", PlainLootAppender(
@ -164,13 +140,11 @@ fun addLootModifiers(it: LootModifiers) {
arrayOf(LootTableIdCondition(BuiltInLootTables.DESERT_PYRAMID)),
ItemStack(MItems.PILL_ANDROID, 1) to 0.15,
ItemStack(MItems.PILL_HEAL, 1) to 0.3,
ItemStack(MItems.PILL_NOT_NORMAL, 3) to 0.25,
))
it.add("jungle_temple_pill", PlainLootAppender(
arrayOf(LootTableIdCondition(BuiltInLootTables.JUNGLE_TEMPLE)),
ItemStack(MItems.PILL_ANDROID, 1) to 0.5,
ItemStack(MItems.PILL_NOT_NORMAL, 8) to 0.2,
ItemStack(MItems.PILL_ANDROID, 1) to 0.5
))
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_HUMANE, 1) to 0.3,
ItemStack(MItems.PILL_OBLIVION, 1) to 0.5,
ItemStack(MItems.ZPM_BATTERY, 1) to 0.004,
ItemStack(MItems.ANTIMATTER_TRANSFORM_MATRIX, 1) to 0.5,
ItemStack(MItems.ZPM_BATTERY, 1) to 0.005,
))
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_NOT_NORMAL, 4) to 0.25,
))
it.add("shipwreck_supply_nutrient_paste", PlainLootAppender(
@ -217,16 +189,6 @@ fun addLootModifiers(it: LootModifiers) {
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(
arrayOf(
LootTableIdCondition(EntityType.WITHER.defaultLootTable),
@ -242,29 +204,4 @@ fun addLootModifiers(it: LootModifiers) {
),
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.Reference2ObjectFunction
import net.minecraft.advancements.critereon.StatePropertiesPredicate
import net.minecraft.core.HolderLookup
import net.minecraft.core.WritableRegistry
import net.minecraft.data.DataGenerator
import net.minecraft.data.loot.LootTableProvider
import net.minecraft.data.loot.LootTableSubProvider
import net.minecraft.resources.ResourceKey
import net.minecraft.util.ProblemReporter
import net.minecraft.resources.ResourceLocation
import net.minecraft.world.level.ItemLike
import net.minecraft.world.level.block.Block
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.entries.LootItem
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.parameters.LootContextParamSet
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.providers.number.ConstantValue
import net.neoforged.neoforge.data.event.GatherDataEvent
import ru.dbotthepony.kommons.collect.stream
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.mc.otm.block.entity.MatteryWorkerBlockEntity
import ru.dbotthepony.mc.otm.core.stream
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) {
private val providersTable = Reference2ObjectArrayMap<LootContextParamSet, HashMap<ResourceKey<LootTable>, () -> LootTable.Builder>>()
val registry: CompletableFuture<HolderLookup.Provider> = generator.lookupProvider
data class NbtCopy(val source: String, val destination: String, val strategy: CopyNbtFunction.MergeStrategy = CopyNbtFunction.MergeStrategy.REPLACE)
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) {
LootTable.lootTable().also(provider)
}
}
fun builder(block: Block, provider: LootPool.Builder.() -> Unit) {
singleLootPool(LootContextParamSets.BLOCK, block.lootTable, provider)
}
fun provider(context: LootContextParamSet, id: ResourceKey<LootTable>, provider: () -> LootTable.Builder) {
fun provider(context: LootContextParamSet, id: ResourceLocation, provider: () -> LootTable.Builder) {
check(providersTable
.computeIfAbsent(context, Reference2ObjectFunction { HashMap() })
.put(id, provider) == null) { "Duplicate loot pool entry for $id" }
@ -63,11 +84,7 @@ class LootTables(generator: GatherDataEvent) : LootTableProvider(generator.gener
}.toList()
}
override fun validate(
writableregistry: WritableRegistry<LootTable>,
validationtracker: ValidationContext,
`problemreporter$collector`: ProblemReporter.Collector
) {}
override fun validate(map: MutableMap<ResourceLocation, LootTable>, validationtracker: ValidationContext) {}
fun createSlabItemTable(block: Block, configurator: LootPoolSingletonContainer.Builder<*>.() -> Unit = {}) {
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) {
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
import net.minecraft.util.valueproviders.UniformInt
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.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
import net.minecraft.world.level.storage.loot.providers.number.ConstantValue
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MItems
fun addChestLootTables(loot: LootTables) {
loot.builder(LootContextParamSets.CHEST, modLootTable("food_box")) {
loot.builder(LootContextParamSets.CHEST, modLocation("food_box")) {
lootPool {
item(Items.PACKED_ICE) { setCount(minimal = 1, maximal = 3) }
item(MItems.NUTRIENT_PASTE) { setCount(minimal = 1, maximal = 2) }
@ -21,106 +17,4 @@ fun addChestLootTables(loot: LootTables) {
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
import net.minecraft.advancements.critereon.EnchantmentPredicate
import net.minecraft.advancements.critereon.ItemEnchantmentsPredicate
import net.minecraft.advancements.critereon.ItemPredicate
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.item.Items
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.entries.LootItem
import net.minecraft.world.level.storage.loot.functions.ApplyBonusCount
import net.minecraft.world.level.storage.loot.functions.SetItemCountFunction
import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets
import net.minecraft.world.level.storage.loot.predicates.ExplosionCondition
import net.minecraft.world.level.storage.loot.predicates.MatchTool
import ru.dbotthepony.mc.otm.util.lookupOrThrow
import ru.dbotthepony.mc.otm.data.loot.Int2NumberProvider
import ru.dbotthepony.mc.otm.registry.game.MBlocks
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())
}
))
}
}
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.registry.MBlocks
import ru.dbotthepony.mc.otm.registry.MItems
import ru.dbotthepony.mc.otm.registry.MRegistry
fun addLootTables(lootTables: LootTables) {
lootTables.dropsSelf(MBlocks.MATTER_CABLE) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MBlocks.ENERGY_CABLES.values) { condition(ExplosionCondition.survivesExplosion()) }
lootTables.dropsSelf(MRegistry.DECORATIVE_CRATE.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.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.dropsOther(MBlocks.GRAVITATION_STABILIZER_LENS, MBlocks.GRAVITATION_STABILIZER)
ore(lootTables, MBlocks.TRITANIUM_ORE, MItems.TRITANIUM_ORE_CLUMP)
ore(lootTables, MBlocks.DEEPSLATE_TRITANIUM_ORE, MItems.TRITANIUM_ORE_CLUMP)
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()) }
ore(lootTables, MBlocks.DILITHIUM_ORE, MItems.DILITHIUM_CRYSTAL, 2)
ore(lootTables, MBlocks.DEEPSLATE_DILITHIUM_ORE, MItems.DILITHIUM_CRYSTAL, 2)
lootTables.dropsSelf(MBlocks.ENGINE) { condition(ExplosionCondition.survivesExplosion()) }
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
import net.minecraft.world.item.DyeColor
import net.minecraft.world.level.block.Block
import net.minecraft.world.level.block.WaterloggedTransparentBlock
import net.neoforged.neoforge.client.model.generators.BlockModelProvider
import net.neoforged.neoforge.data.event.GatherDataEvent
import net.minecraftforge.client.model.generators.BlockModelProvider
import net.minecraftforge.data.event.GatherDataEvent
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 java.util.LinkedList
@ -27,30 +25,6 @@ class MatteryBlockModelProvider(event: GatherDataEvent) : BlockModelProvider(eve
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>) {
for (block in blocks) {
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) {
for (block in blocks) {
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 {
cubeColumn(block.registryName!!.path, modLocation(side), modLocation(end))
cubeColumn(block.registryName!!.path, modLocation(end), modLocation(side))
}
}
fun orientable(block: Block, side: String, front: String) {
exec {
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 decorativeColumn(it: Block, end: String, side: String) {
column(it, "block/decorative/$end", "block/decorative/$side")
}
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
import net.minecraft.core.component.DataComponents
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.tags.ItemTags
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient
import net.neoforged.neoforge.common.Tags
import net.neoforged.neoforge.common.conditions.NotCondition
import net.neoforged.neoforge.common.conditions.TagEmptyCondition
import net.minecraftforge.common.Tags
import ru.dbotthepony.mc.otm.block.entity.MatteryBlockEntity
import ru.dbotthepony.mc.otm.config.CablesConfig
import ru.dbotthepony.mc.otm.util.ResourceLocation
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.game.MItems
import ru.dbotthepony.mc.otm.registry.MItems
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.recipe.ExplosiveHammerPrimingRecipe
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
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(Tags.Items.CHESTS)
.build(consumer)
@ -39,138 +36,50 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.save(consumer, "${crate.registryName}_alt")
}
MItems.ENERGY_COUNTER.values.forEach {
ShapelessRecipeBuilder(machinesCategory, it, 1)
.requires(it)
.unlockedBy(it)
.save(consumer, modLocation("${it.registryName!!.path}_reset"))
}
ShapelessRecipeBuilder(RecipeCategory.BUILDING_BLOCKS, MItems.TRITANIUM_INGOT_BLOCK, 1)
.requires(Ingredient.of(MItemTags.TRITANIUM_INGOTS), 9)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.save(consumer)
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)
.requires(MItems.HOLO_SIGN)
.unlockedBy(MItems.HOLO_SIGN)
.save(consumer, modLocation("holo_sign_reset"))
MatteryRecipe(MBlocks.DRIVE_VIEWER[null]!!, category = machinesCategory)
.rowBC(MItems.DISPLAY_SCREEN, Tags.Items.GLASS_PANES)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItemTags.BASIC_CIRCUIT, MItems.MATTER_IO_PORT, MItemTags.BASIC_CIRCUIT)
.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)
MatteryRecipe(MBlocks.PLATE_PRESS, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
.row(MItemTags.TRITANIUM_INGOTS, Items.BLAST_FURNACE, MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.PISTONS, MItemTags.TRITANIUM_INGOTS, MItemTags.PISTONS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItems.MACHINE_FRAME)
.unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer)
for ((color, item) in MItems.PLATE_PRESS) {
MatteryRecipe(MBlocks.TWIN_PLATE_PRESS[color]!!, category = machinesCategory)
.setUpgradeSource(item)
.addUpgradeOps(UpgradeRecipe.CopyAllComponents)
.rowA(item)
.build(consumer, "plate_press_migration/${color?.name?.lowercase() ?: "default"}")
}
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(MBlocks.PLATE_PRESS, category = machinesCategory)
.rowB(MItems.MACHINE_FRAME)
.rowAC(MItemTags.PISTONS, MItemTags.PISTONS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItems.ELECTRIC_PARTS)
.build(consumer, "advanced")
MatteryRecipe(MItems.PATTERN_DRIVE_NORMAL, category = machinesCategory)
.row(Tags.Items.DUSTS_GLOWSTONE, MItemTags.CARBON_PLATES, Tags.Items.DUSTS_GLOWSTONE)
.row(MItemTags.DILITHIUM_GEMS, MItemTags.ADVANCED_CIRCUIT, MItemTags.DILITHIUM_GEMS)
.row(Tags.Items.DUSTS_GLOWSTONE, Tags.Items.GEMS_DIAMOND, Tags.Items.DUSTS_GLOWSTONE)
.unlockedBy(MItemTags.DILITHIUM_GEMS)
.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)
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
.row(MItemTags.ADVANCED_CIRCUIT, MItemTags.TRITANIUM_PLATES, MItemTags.ADVANCED_CIRCUIT)
.rowAC(MItemTags.ADVANCED_CIRCUIT, MItemTags.ADVANCED_CIRCUIT)
.unlockedBy(MItemTags.ADVANCED_CIRCUIT)
.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(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
@ -178,15 +87,15 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.build(consumer)
// Блоки
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK[null]!!, category = machinesCategory)
.row(Tags.Items.GLASS_BLOCKS, MItemTags.IRON_PLATES, Tags.Items.GLASS_BLOCKS)
MatteryRecipe(MItems.MATTER_CAPACITOR_BANK, category = machinesCategory)
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItems.MATTER_CABLE, MItems.MATTER_IO_PORT, MItems.MATTER_CABLE)
.unlockedBy(MItems.MATTER_CABLE)
.build(consumer)
MatteryRecipe(MItems.BATTERY_BANK[null]!!, category = machinesCategory)
.row(Tags.Items.GLASS_BLOCKS, MItemTags.IRON_PLATES, Tags.Items.GLASS_BLOCKS)
MatteryRecipe(MItems.BATTERY_BANK, category = machinesCategory)
.row(Tags.Items.GLASS, MItemTags.IRON_PLATES, Tags.Items.GLASS)
.row(MItemTags.IRON_PLATES, MItems.MACHINE_FRAME, MItemTags.IRON_PLATES)
.row(MItems.ELECTRIC_PARTS, MItems.ENERGY_BUS, MItems.ELECTRIC_PARTS)
.unlockedBy(MItems.ENERGY_BUS)
@ -223,14 +132,14 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.build(consumer)
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)
.rowAC(Tags.Items.DUSTS_GLOWSTONE, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.GRAVITATION_FIELD_SENSOR)
.build(consumer)
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, ItemTags.BEDS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.QUANTUM_TRANSCEIVER)
@ -245,10 +154,10 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
MatteryRecipe(MItems.ELECTROMAGNET, category = RecipeCategory.MISC)
.row(MItemTags.COPPER_WIRES, Tags.Items.INGOTS_IRON, MItemTags.COPPER_WIRES)
.unlockedBy(Tags.Items.INGOTS_IRON)
.unlockedBy(Tags.Items.ENDER_PEARLS)
.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.ENERGY_BUS, MItemTags.TRITANIUM_PLATES)
.unlockedBy(MItems.ENERGY_BUS)
@ -262,26 +171,11 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.build(consumer)
MatteryRecipe(MItems.REINFORCED_TRITANIUM_PLATE, category = RecipeCategory.MISC)
.rowB(MItemTags.CARBON_PLATES)
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.CARBON_PLATES)
.rowB(MItemTags.CARBON_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES)
.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)
.rowB(MItemTags.CARBON_PLATES)
.row(MItemTags.CARBON_PLATES, MItemTags.TRITANIUM_PLATES, MItemTags.CARBON_PLATES)
.rowB(MItemTags.CARBON_PLATES)
.unlockedBy(MItemTags.TRITANIUM_PLATES)
.build(consumer)
MatteryRecipe(MItems.CARBON_FIBRE_BLOCK, category = RecipeCategory.BUILDING_BLOCKS)
.rowAB(MItemTags.CARBON_PLATES, MItemTags.CARBON_PLATES)
@ -297,40 +191,28 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
// броня
MatteryRecipe(MItems.TRITANIUM_HELMET, category = RecipeCategory.COMBAT)
.setUpgradeSource(Items.LEATHER_HELMET)
.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, MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.row(MItemTags.REINFORCED_TRITANIUM_PLATES, Items.LEATHER_HELMET, MItemTags.REINFORCED_TRITANIUM_PLATES)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer)
MatteryRecipe(MItems.TRITANIUM_PANTS, category = RecipeCategory.COMBAT)
.setUpgradeSource(Items.LEATHER_LEGGINGS)
.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, MItemTags.REINFORCED_TRITANIUM_PLATES, 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)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer)
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, 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)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer)
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, MItems.ARMOR_ASSEMBLY, MItemTags.REINFORCED_TRITANIUM_PLATES)
.rowAC(MItemTags.REINFORCED_TRITANIUM_PLATES, MItemTags.REINFORCED_TRITANIUM_PLATES)
.unlockedBy(MItemTags.REINFORCED_TRITANIUM_PLATES)
.build(consumer)
@ -361,19 +243,58 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.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)
.row(MItems.ELECTRIC_PARTS, MItems.QUANTUM_TRANSCEIVER, MItems.ELECTRIC_PARTS)
MatteryRecipe(MItems.ANDROID_STATION, category = machinesCategory)
.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.ELECTRIC_PARTS, MItemTags.TRITANIUM_PLATES)
.build(consumer)
// беспроводной зарядник андроидов
MatteryRecipe(MItems.ANDROID_CHARGER[null]!!, category = machinesCategory)
.row(MItems.ELECTRIC_PARTS, MItems.QUANTUM_TRANSCEIVER, MItems.ELECTRIC_PARTS)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.build(consumer)
// Энерго меч
MatteryRecipe(MItems.ENERGY_SWORD, category = RecipeCategory.COMBAT)
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.rowBC(MItemTags.TRITANIUM_PLATES, MItemTags.GOLD_WIRES)
.row(MItems.BATTERY_CAPACITOR, MItems.TRITANIUM_SWORD, MItemTags.ADVANCED_CIRCUIT)
.unlockedBy(MItems.BATTERY_CAPACITOR)
.buildEnergetic(consumer)
// апгрейд на сетку крафта
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)
.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(Items.LAVA_BUCKET, Items.HOPPER, Items.WATER_BUCKET)
.rowB(Tags.Items.CHESTS)
@ -414,7 +321,19 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.rowB(MItemTags.REINFORCED_TRITANIUM_PLATES)
.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(MItemTags.TRITANIUM_PLATES, MItems.MACHINE_FRAME, MItemTags.TRITANIUM_PLATES)
.row(MItemTags.GOLD_WIRES, MItemTags.HARDENED_GLASS, MItemTags.HARDENED_GLASS)
@ -426,23 +345,15 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.rowB(Tags.Items.RODS_WOODEN)
.build(consumer)
for ((dye, item) in MItems.MATTER_REPLICATOR) {
MatteryRecipe(MItems.MATTER_RECONSTRUCTOR[dye]!!, category = machinesCategory)
.setUpgradeSource(item)
.addUpgradeOps(
UpgradeRecipe.CopyTileComponent(MatteryBlockEntity.ENERGY_KEY, "energy"),
UpgradeRecipe.CopyTileComponent(MatteryBlockEntity.MATTER_STORAGE_KEY, "matter"),
)
.row(MItemTags.ADVANCED_CIRCUIT, Tags.Items.GEMS_EMERALD, MItemTags.ADVANCED_CIRCUIT)
.row(MItems.ELECTRIC_PARTS, item, MItems.ELECTRIC_PARTS)
.row(MItems.ELECTROMAGNET, MItems.ELECTROMAGNET, MItems.ELECTROMAGNET)
.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)
MatteryRecipe(MItems.MATTER_RECONSTRUCTOR, category = machinesCategory)
.setUpgradeSource(MItems.MATTER_REPLICATOR)
.addUpgradeOps(
UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.ENERGY_KEY}", "BlockEntityTag.energy"),
UpgradeRecipe.Indirect("BlockEntityTag.${MatteryBlockEntity.MATTER_STORAGE_KEY}", "BlockEntityTag.matter"),
)
.row(MItemTags.ADVANCED_CIRCUIT, Tags.Items.GEMS_EMERALD, MItemTags.ADVANCED_CIRCUIT)
.row(MItems.ELECTRIC_PARTS, MItems.MATTER_REPLICATOR, MItems.ELECTRIC_PARTS)
.row(MItems.ELECTROMAGNET, MItems.ELECTROMAGNET, MItems.ELECTROMAGNET)
.build(consumer)
MatteryRecipe(MItems.FLUID_CAPSULE, category = RecipeCategory.TOOLS, count = 8)
@ -461,136 +372,12 @@ fun addCraftingTableRecipes(consumer: RecipeOutput) {
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer)
consumer.accept(ExplosiveHammerPrimingRecipe(modLocation("hammer_priming"), Ingredient.of(Tags.Items.NUGGETS_IRON)).finishedRecipe)
MatteryRecipe(MItems.EXPLOSIVE_HAMMER, category = RecipeCategory.COMBAT)
.rowB(Tags.Items.INGOTS_IRON)
.rowAB(Tags.Items.INGOTS_IRON, Tags.Items.RODS_WOODEN)
.rowB(Tags.Items.RODS_WOODEN)
.unlockedBy(Items.FLINT_AND_STEEL)
.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
import net.minecraft.data.recipes.*
import net.minecraft.tags.ItemTags
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.ItemStack
import net.minecraft.world.item.Items
import net.minecraft.world.item.crafting.Ingredient
import net.minecraft.world.level.ItemLike
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.mc.otm.util.registryName
import net.minecraftforge.common.Tags
import ru.dbotthepony.mc.otm.core.registryName
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.game.MItems
import ru.dbotthepony.mc.otm.registry.MItems
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)
.rowA(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}"))
}
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)
.row(base, base, base)
.unlockedBy(base)
.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)
.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}"))
}
private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: RecipeOutput) {
private fun cut(base: ItemLike, result: ItemLike, amount: Int, consumer: Consumer<FinishedRecipe>) {
SingleItemRecipeBuilder
.stonecutting(Ingredient.of(base), RecipeCategory.BUILDING_BLOCKS, result, amount)
.unlockedBy(base)
.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)
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)
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)
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) {
MatteryRecipe(unrefinedItem, 24)
@ -110,11 +110,9 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
wallWithCut(item, MRegistry.TRITANIUM_STRIPED_WALL.getItem(a, b), consumer)
}
for (color in DyeColor.entries) {
stairsWithCut(MItems.TRITANIUM_STRIPED_BLOCK[color]!!, MItems.TRITANIUM_STRIPED_STAIRS[color]!!, consumer)
slabWithCut(MItems.TRITANIUM_STRIPED_BLOCK[color]!!, MItems.TRITANIUM_STRIPED_SLAB[color]!!, consumer)
wallWithCut(MItems.TRITANIUM_STRIPED_BLOCK[color]!!, MItems.TRITANIUM_STRIPED_WALL[color]!!, consumer)
}
stairsWithCut(MItems.TRITANIUM_STRIPED_BLOCK, MItems.TRITANIUM_STRIPED_STAIRS, consumer)
slabWithCut(MItems.TRITANIUM_STRIPED_BLOCK, MItems.TRITANIUM_STRIPED_SLAB, consumer)
wallWithCut(MItems.TRITANIUM_STRIPED_BLOCK, MItems.TRITANIUM_STRIPED_WALL, consumer)
for ((color, item) in MRegistry.FLOOR_TILES.items) {
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)
.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)
.unlockedBy(Tags.Items.INGOTS_IRON)
.unlockedBy(Tags.Items.DYES_BLACK)
@ -144,7 +142,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
MatteryRecipe(MItems.METAL_BEAM, 24, category = RecipeCategory.BUILDING_BLOCKS)
.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)
.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"}"))
}
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)
.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)
.unlockedBy(Tags.Items.INGOTS_IRON)
.build(consumer, modLocation("decorative/crate/rusty"))
@ -240,7 +233,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
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 paneItem = MRegistry.INDUSTRIAL_GLASS_PANE.items[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()}"))
}
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)
.requires(MItems.LABORATORY_LAMP_INVERTED)
.unlockedBy(MItems.LABORATORY_LAMP_INVERTED)
@ -319,29 +276,17 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItems.LABORATORY_LAMP)
.save(consumer, MItems.LABORATORY_LAMP_INVERTED.registryName!!.toString() + "_inv")
ShapelessRecipeBuilder(RecipeCategory.REDSTONE, MItems.REINFORCED_REDSTONE_LAMP, 1)
.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)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONES, MItemTags.TRITANIUM_INGOTS)
.rowAB(color.tag, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(color.tag)
.build(consumer, modLocation("decorative/blocks/striped_default_${color.name.lowercase()}"))
}
MatteryRecipe(MBlocks.TRITANIUM_STRIPED_BLOCK, 24, category = RecipeCategory.BUILDING_BLOCKS)
.rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, Tags.Items.COBBLESTONE, MItemTags.TRITANIUM_INGOTS)
.rowAB(Tags.Items.DYES_YELLOW, MItemTags.TRITANIUM_INGOTS)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.unlockedBy(Tags.Items.DYES_YELLOW)
.build(consumer, modLocation("decorative/blocks/striped_default"))
MatteryRecipe(MRegistry.TRITANIUM_BLOCK.item, 24, category = RecipeCategory.BUILDING_BLOCKS)
.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)
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.build(consumer, modLocation("decorative/blocks/default"))
@ -353,7 +298,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.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)
.requires(Ingredient.of(MItems.TRITANIUM_DOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
.requires(color.tag)
@ -367,7 +312,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItemTags.TRITANIUM_INGOTS)
.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)
.requires(Ingredient.of(MItems.TRITANIUM_TRAPDOOR.entries.stream().filter { it.key != color }.map { ItemStack(it.value) }))
.requires(color.tag)
@ -380,7 +325,7 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(MItemTags.TRITANIUM_PLATES)
.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)
.requires(Ingredient.of(MRegistry.TRITANIUM_PRESSURE_PLATE.allItems.entries.stream().filter { it.key != dye }.map { ItemStack(it.value) }))
.requires(dye.tag)
@ -404,13 +349,12 @@ fun addDecorativesRecipes(provider: MatteryRecipeProvider, consumer: RecipeOutpu
.unlockedBy(Items.IRON_BARS)
.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)
.row(MItems.METAL_MESH, MItems.METAL_MESH, MItems.METAL_MESH)
.unlockedBy(Items.IRON_BARS)
.unlockedBy(Tags.Items.NUGGETS_IRON)
.unlockedBy(MItems.METAL_MESH)
.build(consumer, modLocation("decorative/metal_railing"))
// лампа
MatteryRecipe(MItems.LABORATORY_LAMP, category = RecipeCategory.REDSTONE)
.row(MItemTags.IRON_PLATES, MItemTags.HARDENED_GLASS_PANES_COLORLESS, MItemTags.IRON_PLATES)
.row(MItems.MIRROR, Items.GLOWSTONE, MItems.MIRROR)
.row(MItemTags.TRITANIUM_PLATES, Tags.Items.DUSTS_REDSTONE, MItemTags.TRITANIUM_PLATES)
.build(consumer, modLocation("decorative/lamp"))
// Голо табличка
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)
.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)
.rowB(MItemTags.TRITANIUM_INGOTS)
.row(MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS, MItemTags.TRITANIUM_INGOTS)
.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
import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.Criterion
import com.google.gson.JsonObject
import net.minecraft.advancements.CriterionTriggerInstance
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapedRecipeBuilder
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.TagKey
import net.minecraft.world.item.Item
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.ShapedRecipe
import net.minecraft.world.level.ItemLike
import net.neoforged.neoforge.common.conditions.ICondition
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.recipe.EnergyContainerRecipe
import ru.dbotthepony.mc.otm.recipe.UpgradeRecipe
import java.util.function.Consumer
private interface RecipeCell {
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 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))
}
fun unlockedBy(name: String, trigger: Criterion<*>): MatteryRecipe {
fun unlockedBy(name: String, trigger: CriterionTriggerInstance): MatteryRecipe {
unlockedBy.add(name to trigger)
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))
}
fun unlockedBy(item: Collection<ItemLike>): MatteryRecipe {
item.forEach { unlockedBy(it) }
return this
}
fun unlockedBy(item: TagKey<Item>): MatteryRecipe {
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
}
private fun filter(): (ShapedRecipe) -> ShapedRecipe {
private fun filter(consumer: Consumer<FinishedRecipe>): Consumer<FinishedRecipe> {
if (upgradeSource != null) {
check(copyPaths.isNotEmpty()) { "Defined upgrade recipe without nbt migration operations" }
return {
UpgradeRecipe(it, copyPaths.map { upgradeSource!! to it })
return Consumer {
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()
if (name != null) {
builder.save(consumer.map(filter()), modLocation(
builder.save(filter(consumer), modLocation(
if (result.asItem().registryName!!.namespace == OverdriveThatMatters.MOD_ID)
"${result.asItem().registryName!!.path}_$name"
else
"${result.asItem().registryName!!.namespace}_${result.asItem().registryName!!.path}_$name"
))
} else {
builder.save(consumer.map(filter()))
builder.save(filter(consumer))
}
}
fun build(consumer: RecipeOutput, name: ResourceLocation) {
buildRegular().save(consumer.map(filter()), name)
fun build(consumer: Consumer<FinishedRecipe>, name: ResourceLocation) {
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 {

View File

@ -1,71 +1,50 @@
package ru.dbotthepony.mc.otm.datagen.recipes
import com.google.common.collect.ImmutableList
import net.minecraft.advancements.Advancement
import net.minecraft.advancements.AdvancementHolder
import net.minecraft.advancements.CriteriaTriggers
import net.minecraft.advancements.Criterion
import net.minecraft.advancements.critereon.ContextAwarePredicate
import net.minecraft.advancements.critereon.EntityPredicate
import net.minecraft.advancements.critereon.InventoryChangeTrigger
import net.minecraft.advancements.critereon.ItemPredicate
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.RecipeOutput
import net.minecraft.data.recipes.RecipeProvider
import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.ItemTags
import net.minecraft.tags.TagKey
import net.minecraft.util.valueproviders.ConstantFloat
import net.minecraft.util.valueproviders.FloatProvider
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.Recipe
import net.minecraft.world.item.crafting.ShapedRecipePattern
import net.minecraft.world.level.ItemLike
import net.neoforged.neoforge.common.conditions.ICondition
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.core.registryName
import ru.dbotthepony.mc.otm.datagen.modLocation
import ru.dbotthepony.mc.otm.recipe.MicrowaveRecipe
import ru.dbotthepony.mc.otm.recipe.PlatePressRecipe
import java.util.*
import java.util.LinkedList
import java.util.function.Consumer
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())
}
fun has(p_125978_: ItemLike): Criterion<InventoryChangeTrigger.TriggerInstance> {
fun has(p_125978_: ItemLike): InventoryChangeTrigger.TriggerInstance {
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())
}
fun inventoryTrigger(vararg p_126012_: ItemPredicate): Criterion<InventoryChangeTrigger.TriggerInstance> {
return CriteriaTriggers.INVENTORY_CHANGED.createCriterion(InventoryChangeTrigger.TriggerInstance(
Optional.empty(),
InventoryChangeTrigger.TriggerInstance.Slots.ANY,
ImmutableList.copyOf(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 inventoryTrigger(vararg p_126012_: ItemPredicate): InventoryChangeTrigger.TriggerInstance {
return InventoryChangeTrigger.TriggerInstance(
ContextAwarePredicate.ANY,
MinMaxBounds.Ints.ANY,
MinMaxBounds.Ints.ANY,
MinMaxBounds.Ints.ANY,
p_126012_
)
}
fun <T : RecipeBuilder> T.unlockedBy(item: ItemLike): T {
@ -87,28 +66,7 @@ fun <T : RecipeBuilder> T.unlockedBy(item: TagKey<Item>): T {
return this
}
fun <IN : Recipe<*>> RecipeOutput.map(mapper: (IN) -> Recipe<*>): RecipeOutput {
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) {
class MatteryRecipeProvider(generatorIn: DataGenerator) : RecipeProvider(generatorIn.packOutput) {
private val callbacks = LinkedList<RecipeBuilderCallback>()
fun exec(callback: RecipeBuilderCallback): MatteryRecipeProvider {
@ -116,7 +74,7 @@ class MatteryRecipeProvider(generatorIn: GatherDataEvent) : RecipeProvider(gener
return this
}
override fun buildRecipes(callback: RecipeOutput) {
override fun buildRecipes(callback: Consumer<FinishedRecipe>) {
for (lambda in callbacks) {
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) {
exec { _, consumer ->
consumer.accept(modLocation("plates/$id"), PlatePressRecipe(
Ingredient.of(ItemTags.create(ResourceLocation("c", "ingots/$id"))),
Ingredient.of(ItemTags.create(ResourceLocation("c", "plates/$id"))),
consumer.accept(PlatePressShallowFinishedRecipe(
modLocation("plates/$id"),
ResourceLocation("forge", "ingots/$id"),
ResourceLocation("forge", "plates/$id"),
count,
workTicks,
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) {
exec { it, callback ->
callback.accept(modLocation("plate_$id"), PlatePressRecipe(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))
callback.accept(PlatePressFinishedRecipe(PlatePressRecipe(modLocation("plate_$id"), 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.world.item.Items
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.game.MItems
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 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("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
import net.minecraft.data.recipes.FinishedRecipe
import net.minecraft.data.recipes.RecipeCategory
import net.minecraft.data.recipes.RecipeOutput
import net.minecraft.data.recipes.ShapelessRecipeBuilder
import net.minecraft.tags.TagKey
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.minecraft.world.level.ItemLike
import net.neoforged.neoforge.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.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 java.util.function.Consumer
fun hammerRecipe(output: ItemLike, input: ItemLike, consumer: RecipeOutput) {
ShapelessRecipeBuilder(RecipeCategory.MISC, output, 1)
.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) {
fun addShapelessRecipes(consumer: Consumer<FinishedRecipe>) {
for (color in DyeColor.values()) {
ShapelessRecipeBuilder(RecipeCategory.TRANSPORTATION, MItems.CARGO_CRATE_MINECARTS[color]!!, 1)
.requires(Items.MINECART)
.requires(MRegistry.CARGO_CRATES.items[color]!!)
@ -57,60 +36,4 @@ fun addShapelessRecipes(consumer: RecipeOutput) {
.unlockedBy(Items.MINECART)
.unlockedBy(MRegistry.CARGO_CRATES.item)
.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.world.effect.MobEffects
import net.minecraft.world.item.Items
import net.neoforged.neoforge.common.Tags
import ru.dbotthepony.kommons.collect.flatMap
import ru.dbotthepony.mc.otm.util.ResourceLocation
import net.minecraft.world.item.Tiers
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.game.MFluids
import ru.dbotthepony.mc.otm.registry.MBlocks
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
fun addTags(tagsProvider: TagsProvider) {
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)
.add(MItems.TRITANIUM_INGOT)
.add(MItems.DILITHIUM_CRYSTAL)
.add(MItems.WITHERED_STEEL)
.add(MItems.ROFLITE_ALLOY_INGOT)
tagsProvider.dusts.add("tritanium", MItems.TRITANIUM_DUST)
tagsProvider.ingots.add("tritanium", MItems.TRITANIUM_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.fluidTypes.forge("experience").add(MFluids.LIQUID_XP_TYPE)
tagsProvider.items.forge("reinforced_tritanium").add(MItems.REINFORCED_TRITANIUM_PLATE)
tagsProvider.items.Appender(MItemTags.CRAFTING_TABLES)
.add(MItemTags.WORKBENCHES)
.add(MItemTags.WORKBENCH)
tagsProvider.storageBlocksAsItem.add("tritanium", MItems.TRITANIUM_INGOT_BLOCK)
tagsProvider.storageBlocksAsBlock.add("tritanium", MBlocks.TRITANIUM_INGOT_BLOCK)
tagsProvider.blocks.Appender(MBlockTags.CRAFTING_TABLES)
.add(MBlockTags.WORKBENCHES)
.add(MBlockTags.WORKBENCH)
tagsProvider.stoneOre("tritanium", MBlocks.TRITANIUM_ORE)
tagsProvider.deepslateOre("tritanium", MBlocks.DEEPSLATE_TRITANIUM_ORE)
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.blocks.Appender(BlockTags.ANVIL).add(MBlocks.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() })
tagsProvider.items.Appender(ItemTags.ANVIL).add(MItems.TRITANIUM_ANVIL.values.stream().flatMap { it.stream() })
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.Appender(MItemTags.UPGRADES)
.add(MItems.MachineUpgrades.Basic.LIST)
.add(MItems.MachineUpgrades.Normal.LIST)
.add(MItems.MachineUpgrades.Advanced.LIST)
.add(MItems.MachineUpgrades.Creative.LIST)
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.items.Appender(MItemTags.NO_REPLICATION)
.add(MItemTags.DILITHIUM_GEMS)
.add(MItemTags.DILITHIUM_ORES)
.add(Items.WRITTEN_BOOK)
.add(Tags.Items.ORES)
.add(Tags.Items.RAW_MATERIALS)
.add(MItems.PILL_ANDROID)
.add(MItems.PILL_HUMANE)
.add(MItems.PILL_OBLIVION)
.add(MItems.QUANTUM_BATTERY)
.add(MItems.QUANTUM_CAPACITOR)
.add(MItems.QUANTUM_BATTERY_CREATIVE)
.add(MItems.ZPM_BATTERY)
.add(MItems.PROCEDURAL_BATTERY)
.add(MItems.EXOPACK_PROBE)
.add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_PROCEDURAL)
.add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_WITHER)
.add(MItems.ExopackUpgrades.INVENTORY_UPGRADE_ENDER_DRAGON)
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) }
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.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.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.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(
MBlocks.BLACK_HOLE,
@ -76,12 +236,6 @@ fun addTags(tagsProvider: TagsProvider) {
MBlocks.BLACK_HOLE,
)
tagsProvider.guardedByPiglins.add(
MBlockTags.CARGO_CRATES,
)
tagsProvider.impermeable.add(MRegistry.INDUSTRIAL_GLASS.allBlocks.values)
tagsProvider.androidImmuneEffects.add(
MobEffects.CONDUIT_POWER,
MobEffects.HEAL,
@ -98,9 +252,4 @@ fun addTags(tagsProvider: TagsProvider) {
MobEffects.DOLPHINS_GRACE,
MobEffects.CONFUSION,
)
tagsProvider.androidImmuneEffects.add(
ResourceLocation("rats", "plague"),
ResourceLocation("rats", "synesthesia"),
)
}

View File

@ -1,7 +1,6 @@
package ru.dbotthepony.mc.otm.datagen.tags
import it.unimi.dsi.fastutil.objects.ObjectArraySet
import net.minecraft.core.Holder
import net.minecraft.core.HolderLookup
import net.minecraft.core.Registry
import net.minecraft.core.registries.BuiltInRegistries
@ -11,18 +10,15 @@ import net.minecraft.resources.ResourceLocation
import net.minecraft.tags.BlockTags
import net.minecraft.tags.GameEventTags
import net.minecraft.tags.TagKey
import net.minecraft.world.item.DyeColor
import net.minecraft.world.item.Item
import net.minecraft.world.item.Tier
import net.minecraft.world.item.Tiers
import net.minecraft.world.level.block.Block
import net.neoforged.neoforge.common.Tags
import net.neoforged.neoforge.data.event.GatherDataEvent
import net.neoforged.neoforge.registries.NeoForgeRegistries
import ru.dbotthepony.mc.otm.player.MatteryPlayer
import ru.dbotthepony.mc.otm.util.ResourceLocation
import net.minecraftforge.data.event.GatherDataEvent
import net.minecraftforge.registries.ForgeRegistries
import net.minecraftforge.registries.IForgeRegistry
import ru.dbotthepony.mc.otm.capability.MatteryPlayerCapability
import ru.dbotthepony.mc.otm.datagen.DataGen
import java.util.EnumMap
import java.util.stream.Stream
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) {
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))
init {
@ -95,11 +91,6 @@ class TagsProvider(private val event: GatherDataEvent) {
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 {
for (value in values) add(value)
return this
@ -115,11 +106,6 @@ class TagsProvider(private val event: GatherDataEvent) {
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 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 forge(path: String) = Appender(ResourceLocation("c", path))
fun forge(path: String) = Appender(ResourceLocation("forge", path))
fun minecraft(path: String) = Appender(ResourceLocation("minecraft", path))
override fun addTags(provider: HolderLookup.Provider) {
@ -157,7 +143,7 @@ class TagsProvider(private val event: GatherDataEvent) {
val appender = tag(tag)
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 items = Delegate(BuiltInRegistries.ITEM)
val fluids = Delegate(BuiltInRegistries.FLUID)
val fluidTypes = Delegate(NeoForgeRegistries.Keys.FLUID_TYPES)
val mobEffects = Delegate(BuiltInRegistries.MOB_EFFECT)
val entityTypes = Delegate(BuiltInRegistries.ENTITY_TYPE)
val blocks = Delegate(ForgeRegistries.BLOCKS)
val items = Delegate(ForgeRegistries.ITEMS)
val mobEffects = Delegate(ForgeRegistries.MOB_EFFECTS)
val damageTypes = Delegate(Registries.DAMAGE_TYPE)
val structures = Delegate(Registries.STRUCTURE)
private val coloredItems = EnumMap<DyeColor, Delegate<Item>.Appender>(DyeColor::class.java)
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 androidImmuneEffects = mobEffects.Appender(MatteryPlayerCapability.ANDROID_IMMUNE_EFFECTS)
val requiresShovel = blocks.Appender(BlockTags.MINEABLE_WITH_SHOVEL)
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 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 {
ore(key, block)
@ -246,17 +210,8 @@ class TagsProvider(private val event: GatherDataEvent) {
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 {
val forgeKey = ResourceLocation("c", "ores/$key")
val forgeKey = ResourceLocation("forge", "ores/$key")
val b = TagKey.create(Registries.BLOCK, forgeKey)
val i = TagKey.create(Registries.ITEM, forgeKey)
@ -288,30 +243,29 @@ class TagsProvider(private val event: GatherDataEvent) {
}
val circuits = items.forge("circuits")
val dusts = items.Appender(Tags.Items.DUSTS)
val ingots = items.Appender(Tags.Items.INGOTS)
val itemOres = items.Appender(Tags.Items.ORES)
val gems = items.Appender(Tags.Items.GEMS)
val blockOres = blocks.Appender(Tags.Blocks.ORES)
val dusts = items.forge("dusts")
val ingots = items.forge("ingots")
val itemOres = items.forge("ores")
val blockOres = blocks.forge("ores")
val plates = items.forge("plates")
val storageBlocksAsItem = items.Appender(Tags.Items.STORAGE_BLOCKS)
val storageBlocksAsBlock = blocks.Appender(Tags.Blocks.STORAGE_BLOCKS)
val rawMaterials = items.Appender(Tags.Items.RAW_MATERIALS)
val storageBlocksAsItem = items.forge("storage_blocks")
val storageBlocksAsBlock = blocks.forge("storage_blocks")
val rawMaterials = items.forge("raw_materials")
val wires = items.forge("wires")
val blockGroundOresStone = blocks.Appender(Tags.Blocks.ORES_IN_GROUND_STONE)
val blockGroundOresDeepslate = blocks.Appender(Tags.Blocks.ORES_IN_GROUND_DEEPSLATE)
val blockGroundOresStone = blocks.forge("ores_in_ground/stone")
val blockGroundOresDeepslate = blocks.forge("ores_in_ground/deepslate")
// val blockGroundOresNetherrack = blocks.forge("ores_in_ground/netherrack")
val itemGroundOresStone = items.Appender(Tags.Items.ORES_IN_GROUND_STONE)
val itemGroundOresDeepslate = items.Appender(Tags.Items.ORES_IN_GROUND_DEEPSLATE)
val itemGroundOresStone = items.forge("ores_in_ground/stone")
val itemGroundOresDeepslate = items.forge("ores_in_ground/deepslate")
// val itemGroundOresNetherrack = items.forge("ores_in_ground/netherrack")
// val blockOreRatesSparse = blocks.forge("ore_rates/sparse")
val blockOreRatesSingular = blocks.Appender(Tags.Blocks.ORE_RATES_SINGULAR)
val blockOreRatesDense = blocks.forge("ore_rates/dense")
val blockOreRatesSingular = blocks.forge("ore_rates/singular")
// val blockOreRatesDense = blocks.forge("ore_rates/dense")
// val itemOreRatesSparse = items.forge("ore_rates/sparse")
val itemOreRatesSingular = items.Appender(Tags.Items.ORE_RATES_SINGULAR)
val itemOreRatesDense = items.forge("ore_rates/dense")
val itemOreRatesSingular = items.forge("ore_rates/singular")
// val itemOreRatesDense = items.forge("ore_rates/dense")
val gameEvents = Delegate(Registries.GAME_EVENT)
val vibrations = gameEvents.Appender(GameEventTags.VIBRATIONS)
@ -333,16 +287,6 @@ class TagsProvider(private val event: GatherDataEvent) {
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 {
for (block in blocks) requiresPickaxe(block, tier)
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;
import net.minecraft.core.Direction;
import net.minecraft.resources.ResourceLocation;
import net.neoforged.neoforge.capabilities.BlockCapability;
import net.neoforged.neoforge.capabilities.ItemCapability;
import mekanism.api.energy.IStrictEnergyHandler;
import net.minecraftforge.common.capabilities.CapabilityManager;
import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.CapabilityToken;
import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent;
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.energy.IMatteryEnergyStorage;
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.graph.matter.MatterNode;
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;
public class MatteryCapability {
@Nonnull
@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
@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
@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
@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
@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
@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
@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
@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
@NotNull
// this weird cast is required because otherwise IMatteryDrive gets incompatible lower-bound due to Java raw generic type
// 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);
public static final Capability<IStrictEnergyHandler> MEKANISM_ENERGY = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull
@NotNull
public static final BlockCapability<StorageNode, @Nullable Direction> STORAGE_NODE = BlockCapability.createSided(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "storage_node"), StorageNode.class);
// 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);
public static final Capability<ICuriosItemHandler> CURIOS_INVENTORY = CapabilityManager.get(new CapabilityToken<>() {});
@Nonnull
@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
@NotNull
public static final BlockCapability<IQuickStackContainer, Void> QUICK_STACK_CONTAINER = BlockCapability.createVoid(ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "quick_stack_container"), IQuickStackContainer.class);
public static void register(RegisterCapabilitiesEvent event) {
event.register(IMatteryEnergyStorage.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.player.PlayerRenderer;
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.player.IMatteryPlayer;
import ru.dbotthepony.mc.otm.capability.MatteryCapability;
import javax.annotation.Nonnull;
import java.util.Set;
@ -31,8 +31,7 @@ public final class ExosuitModel {
public static final HumanoidModel<AbstractClientPlayer> modelNormal;
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 textureColor = ResourceLocation.fromNamespaceAndPath(OverdriveThatMatters.MOD_ID, "textures/models/armor/exosuit_color.png");
public static final ResourceLocation texture = new ResourceLocation(OverdriveThatMatters.MOD_ID, "textures/models/armor/exosuit.png");
static {
MeshDefinition meshdefinition = new MeshDefinition();
@ -103,6 +102,7 @@ public final class ExosuitModel {
super(p_117346_);
}
@SuppressWarnings("OptionalGetWithoutIsPresent")
@Override
public void render(
@Nonnull PoseStack poseStack,
@ -116,12 +116,13 @@ public final class ExosuitModel {
float p_117357_,
float p_117358_
) {
if (player.isInvisible())
var cap = player.getCapability(MatteryCapability.MATTERY_PLAYER);
if (!cap.isPresent()) {
return;
}
var mattery = ((IMatteryPlayer) player).getOtmPlayer();
if (mattery.getHasExopack() && mattery.isExopackVisible()) {
if (cap.resolve().get().getHasExoPack() && cap.resolve().get().getDisplayExoPack()) {
var model = getParentModel();
model.copyPropertiesTo(modelNormal);
model.copyPropertiesTo(modelGlow);
@ -134,41 +135,17 @@ public final class ExosuitModel {
packedLight,
overlayCoords,
// 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(
poseStack,
bufferSource.getBuffer(RenderType.entityTranslucentEmissive(texture)),
packedLight,
overlayCoords,
-1
);
} else {
modelGlow.renderToBuffer(
poseStack,
bufferSource.getBuffer(RenderType.entityCutoutNoCull(texture)),
packedLight,
overlayCoords,
// rgba
-1
);
}
mattery.makeSmokeParticles(poseStack, model);
modelGlow.renderToBuffer(
poseStack,
bufferSource.getBuffer(RenderType.entityTranslucentEmissive(texture)),
packedLight,
overlayCoords,
// rgba
1f, 1f, 1f, 1f
);
}
}
}

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.PartPose;
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.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.PartPose;
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;

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