diff --git a/build.gradle b/build.gradle index d7ce350..a48227f 100644 --- a/build.gradle +++ b/build.gradle @@ -28,7 +28,7 @@ apply plugin: 'kotlin' apply plugin: 'org.jetbrains.kotlin.jvm' apply plugin: 'maven-publish' -version = "0.1.0" +version = "0.1.3" group = "club.someoneice.ovo" archivesBaseName = "WithJson-1.7.10" @@ -40,12 +40,9 @@ minecraft { repositories { mavenCentral() maven { - name = "GitHubPackages" - url = uri("https://maven.pkg.github.com/amarokice/withpineapplepsychic") - credentials { - username = "AmarokIce" - password = ProcessEnvironment.getenv("GITHUB_TOKEN") - } + name = "AmarokMaven" + url "http://maven.snowlyicewolf.club/" + allowInsecureProtocol = true } flatDir{ @@ -56,7 +53,9 @@ repositories { dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion" - // implementation 'club.someoneice.pineapplepsychic:pineapple-psychic:1.2.1' + implementation "club.someoneice.pineapplepsychic:pineapple-psychic:1.3.1" + implementation "club.someoneice.togocup.recipebook:PineappleRecipeBook:1.0" + implementation fileTree(dir: 'lib', includes: ['*.jar']) } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6d26d17..d789009 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip diff --git a/src/main/kotlin/club/someoneice/ovo/base/BlockBase.kt b/src/main/kotlin/club/someoneice/ovo/base/BlockBase.kt index 3949daf..214fb2f 100644 --- a/src/main/kotlin/club/someoneice/ovo/base/BlockBase.kt +++ b/src/main/kotlin/club/someoneice/ovo/base/BlockBase.kt @@ -14,8 +14,9 @@ import net.minecraft.world.World class BlockBase(material: Material, private val blockSet: BlockData): Block(material) { init { this.setHardness(blockSet.hard.toFloat()) - this.setHarvestLevel(blockSet.break_tool, blockSet.hard_level) - + blockSet.break_tool?.let { + this.setHarvestLevel(it, blockSet.hard_level) + } if (blockSet.is_glow) this.setLightLevel(15.0F) if (DataList.getGroup.containsKey(blockSet.group)) { @@ -28,13 +29,13 @@ class BlockBase(material: Material, private val blockSet: BlockData): Block(mate } override fun getDrops(world: World?, x: Int, y: Int, z: Int, metadata: Int, fortune: Int): ArrayList { - val itemlist = Lists.newArrayList() - when(blockSet.drop_item) { - "null" -> return itemlist - "this" -> itemlist.add(ItemStack(this)) - else -> itemlist.add(ItemStack(findItemByText(blockSet.drop_item))) - } + return Lists.newArrayList().also { + when(blockSet.drop_item) { + "null" -> Unit + "this" -> it.add(ItemStack(this)) + else -> it.add(ItemStack(findItemByText(blockSet.drop_item))) - return itemlist + } + } } } \ No newline at end of file diff --git a/src/main/kotlin/club/someoneice/ovo/core/JarRunner.kt b/src/main/kotlin/club/someoneice/ovo/core/JarRunner.kt index 0ce0e21..7e7d66c 100644 --- a/src/main/kotlin/club/someoneice/ovo/core/JarRunner.kt +++ b/src/main/kotlin/club/someoneice/ovo/core/JarRunner.kt @@ -41,39 +41,46 @@ class JarRunner { } for (key in mappings.keys) { - val mapping: ArrayList = mappings[key]!! - if (mapping.isNotEmpty() && infoMappings.containsKey(key)) { - val type = object: TypeToken>() {}.type - val modid: String? = - (gson.fromJson(JarUtil.getInstance().readFileFromUrl(infoMappings[key]), type) as HashMap).let { it["modid"] } - for (url in mappings[key]!!) { - if (url == infoMappings[key]) continue - val fileName = url.fileUrl.substring(url.fileUrl.lastIndexOf("/") + 1, url.fileUrl.lastIndexOf(".")) - if (set.contains(fileName.lowercase())) fileName - else { - val path = url.fileUrl.replace("ovo/${key}/", "") - val filePath = path.substring(0, path.indexOf("/")) - if (set.contains(filePath.lowercase())) filePath - else null - }?.let { - val txt = JarUtil.getInstance().readFileFromUrl(url) ?: return@let - when (it.lowercase()) { - "Item".lowercase() -> CoreRunner.item.init (txt, DataList.dataItem) - "ItemFood".lowercase() -> CoreRunner.food.init (txt, DataList.dataItemFood) - "ItemGift".lowercase() -> CoreRunner.gift.init (txt, DataList.dataItemGift) - "ItemTool".lowercase() -> CoreRunner.tool.init (txt, DataList.dataItemTool) - "ItemWeapons".lowercase() -> CoreRunner.swords.init (txt, DataList.dataItemWeapons) - "Block".lowercase() -> CoreRunner.block.init (txt, DataList.dataBlock) - "Recipe".lowercase() -> CoreRunner.recipes.init (txt, DataList.dataRecipes) - "DeleteRecipe".lowercase() -> CoreRunner.delete_recipes.init (txt, DataList.dataDeleteRecipes) - "Biomes".lowercase() -> CoreRunner.biomes.init (txt, DataList.dataBiomes) - "Group".lowercase() -> CoreRunner.group.init (txt, DataList.dataGroup) - } - } - } + processor(mappings, infoMappings, key) + } + } + + private fun processor(mappings: HashMap>, infoMappings: HashMap, key: String) { + val mapping: ArrayList = mappings[key]!! + if (mapping.isNotEmpty() && infoMappings.containsKey(key)) { + val type = object: TypeToken>() {}.type + val modid: String? = + (gson.fromJson(JarUtil.getInstance().readFileFromUrl(infoMappings[key]), type) as HashMap).let { it["modid"] } + for (url in mappings[key]!!) + processorUrl(url, infoMappings, key) + + DataProcessor(modid).init() + DataList.init() + } + } - DataProcessor(modid).init() - DataList.init() + private fun processorUrl(url: JarUtil.UrlBuffered, infoMappings: HashMap, key: String) { + if (url == infoMappings[key]) return + val fileName = url.fileUrl.substring(url.fileUrl.lastIndexOf("/") + 1, url.fileUrl.lastIndexOf(".")) + if (set.contains(fileName.lowercase())) fileName + else { + val path = url.fileUrl.replace("ovo/${key}/", "") + val filePath = path.substring(0, path.indexOf("/")) + if (set.contains(filePath.lowercase())) filePath + else null + }?.let { + val txt = JarUtil.getInstance().readFileFromUrl(url) ?: return@let + when (it.lowercase()) { + "Item".lowercase() -> CoreRunner.item.init (txt, DataList.dataItem) + "ItemFood".lowercase() -> CoreRunner.food.init (txt, DataList.dataItemFood) + "ItemGift".lowercase() -> CoreRunner.gift.init (txt, DataList.dataItemGift) + "ItemTool".lowercase() -> CoreRunner.tool.init (txt, DataList.dataItemTool) + "ItemWeapons".lowercase() -> CoreRunner.swords.init (txt, DataList.dataItemWeapons) + "Block".lowercase() -> CoreRunner.block.init (txt, DataList.dataBlock) + "Recipe".lowercase() -> CoreRunner.recipes.init (txt, DataList.dataRecipes) + "DeleteRecipe".lowercase() -> CoreRunner.delete_recipes.init (txt, DataList.dataDeleteRecipes) + "Biomes".lowercase() -> CoreRunner.biomes.init (txt, DataList.dataBiomes) + "Group".lowercase() -> CoreRunner.group.init (txt, DataList.dataGroup) } } } diff --git a/src/main/kotlin/club/someoneice/ovo/core/OVOMain.kt b/src/main/kotlin/club/someoneice/ovo/core/OVOMain.kt index bb591a0..0c25081 100644 --- a/src/main/kotlin/club/someoneice/ovo/core/OVOMain.kt +++ b/src/main/kotlin/club/someoneice/ovo/core/OVOMain.kt @@ -11,7 +11,7 @@ import org.apache.logging.log4j.Logger class OVOMain { companion object { const val MODID: String = "ovo" - const val VERSION: String = "0.1.2" + const val VERSION: String = "0.1.3" val ManaMetalModInstall: Boolean = Loader.isModLoaded("manametalmod") val PineapplePsychicInstall: Boolean = Loader.isModLoaded("pineapple_psychic") diff --git a/src/main/kotlin/club/someoneice/ovo/core/object/DataList.kt b/src/main/kotlin/club/someoneice/ovo/core/object/DataList.kt index 557821b..c9eca97 100644 --- a/src/main/kotlin/club/someoneice/ovo/core/object/DataList.kt +++ b/src/main/kotlin/club/someoneice/ovo/core/object/DataList.kt @@ -21,7 +21,6 @@ object DataList { val dataRecipes :ArrayList = Lists.newArrayList() val dataDeleteRecipes :ArrayList = Lists.newArrayList() - // Clean all the data list. fun init() { dataItem.clear() dataBlock.clear() diff --git a/src/main/kotlin/club/someoneice/ovo/data/BlockData.kt b/src/main/kotlin/club/someoneice/ovo/data/BlockData.kt index 715d9b5..02c4433 100644 --- a/src/main/kotlin/club/someoneice/ovo/data/BlockData.kt +++ b/src/main/kotlin/club/someoneice/ovo/data/BlockData.kt @@ -6,7 +6,7 @@ data class BlockData( val texture_name: String = name, val hard: Int = 1, val hard_level: Int = 0, - val break_tool: String, + val break_tool: String?, val is_glow: Boolean = false, val drop_item: String = name, val group: String = "null" diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index dff49b6..19ff936 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -3,7 +3,7 @@ "modid": "ovo", "name": "With Json", "description": "A mod for minecraft, and now you can use json to make more Items!", - "version": "0.1.2", + "version": "0.1.3", "mcversion": "${mcversion}", "url": "", "updateUrl": "",