Skip to content

Commit

Permalink
Generator
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarokIce committed May 7, 2024
1 parent 5e552ab commit 5a97979
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main/kotlin/club/someoneice/ovo/core/DataProcessor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ class DataProcessor(data: File, private val modid: String) {
this.dataDeleteRecipes.forEach { it.toItemStack()?.let(RemoveRecipes::removeAllRecipe) }

val itemListCache = HashMap<String, Item>()
val blockListCache = HashMap<String, Block>()

this.dataItem.forEach { itemListCache[it.name] = it.registryItem(modid) }
this.dataItemTool.forEach { itemListCache[it.name] = it.registerTool() }

val blockListCache = HashMap<String, Block>()
this.dataBlock.forEach { blockListCache[it.name] = it.registerBlock() }

this.dataBiomes.forEach(BiomesData::register)
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/club/someoneice/ovo/data/BiomesData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ data class BiomesData (

@SideOnly(Side.CLIENT) override fun getModdedBiomeGrassColor(original: Int): Int = this@BiomesData.grassColor
@SideOnly(Side.CLIENT) override fun getWaterColorMultiplier(): Int = this@BiomesData.waterColor
@SideOnly(Side.CLIENT) override fun getBiomeGrassColor(p_150558_1_: Int, p_150558_2_: Int, p_150558_3_: Int): Int = this@BiomesData.grassColor
@SideOnly(Side.CLIENT) override fun getBiomeFoliageColor(p_150571_1_: Int, p_150571_2_: Int, p_150571_3_: Int): Int = this@BiomesData.grassColor
@SideOnly(Side.CLIENT) override fun getBiomeGrassColor(x: Int, y: Int, z: Int): Int = this@BiomesData.grassColor
@SideOnly(Side.CLIENT) override fun getBiomeFoliageColor(x: Int, y: Int, z: Int): Int = this@BiomesData.grassColor
}
}

Expand Down
25 changes: 24 additions & 1 deletion src/main/kotlin/club/someoneice/ovo/generator/GeneratorMain.kt
Original file line number Diff line number Diff line change
@@ -1,4 +1,27 @@
package club.someoneice.ovo.generator

class GeneratorMain {
import java.io.File

object GeneratorMain {
@JvmStatic
fun main(args: Array<String>) {
val path = if (args.size > 1) args[0] else askForPath()
val file = File(path)
if (!file.exists() || !file.isDirectory) throw IllegalArgumentException("Cannot scan a non-directory!")

file.listFiles()?.forEach(GeneratorMain::scanFile)
}

private fun scanFile(file: File) {
if (!file.endsWith(".json") && !file.endsWith(".json5")) return
val fileName = file.nameWithoutExtension

}

private fun askForPath(): String {
println("请输入路径:")
while (true) {
readln().apply { if (isEmpty()) return@apply else return@askForPath this }
}
}
}

0 comments on commit 5a97979

Please sign in to comment.