From 889dae17004ca6c8dc397ae2015f74f4b7e6acb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thea=20Sch=C3=B6bl?= Date: Sat, 21 Mar 2020 19:49:18 +0100 Subject: [PATCH] Add test Block --- .idea/encodings.xml | 6 ++ README.md | 62 +------------------ gradle.properties | 4 +- .../www/newfrontiers/NewFrontiers.kt} | 55 ++++++++-------- .../wulkanat/www/newfrontiers/StaticValues.kt | 5 ++ .../www/newfrontiers/blocks/NFBlock.kt | 8 +++ .../newfrontiers/blocks/SpaceTeleporter.kt | 13 ++++ src/main/resources/mcmod.info | 6 +- 8 files changed, 67 insertions(+), 92 deletions(-) create mode 100644 .idea/encodings.xml rename src/main/kotlin/{io/github/proudust/minecraftforgekotlintemplate/MinecraftForgeKotlinTemplate.kt => de/wulkanat/www/newfrontiers/NewFrontiers.kt} (61%) create mode 100644 src/main/kotlin/de/wulkanat/www/newfrontiers/StaticValues.kt create mode 100644 src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/NFBlock.kt create mode 100644 src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/SpaceTeleporter.kt diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..910613c --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index 117406d..a71c853 100644 --- a/README.md +++ b/README.md @@ -1,61 +1,3 @@ -# Minecraft Forge Kotlin Template -Minecraft 1.12.2 で Forge と Kotlin を用いた Mod のテンプレートです。 -Minecraft 1.12.2 Mod template using Forge and Kotlin. +# Minecraft New Frontiers Mod -## Getting Started -### Clone template -Please click [Use this template](https://github.com/proudust/minecraft-forge-kotlin-template/generate) - -or - -```sh -git clone --depth=1 https://github.com/proudust/minecraft-forge-kotlin-template -cd -rm -rf .git -``` - -### Install dependencies -```sh -./gradlew build -``` - -### Fix properties -**gradle.properties** -``` -modGroup= -modVersion= -modBaseName= -``` - -**mcmod.info** -```json -{ - "modid": "", - "name": "", -} -``` - -**MinecraftForgeKotlinTemplate.kt** -```kt -package . - -//... - -object { - const val MOD_ID = - const val MOD_NAME = - const val VERSION = - - //... -} -``` - -## Dependencies - -- [Minecraft Forge](https://files.minecraftforge.net/) -- [shadowfacts/Forgelin](https://github.com/shadowfacts/Forgelin) - -## References - -- [C6H2Cl2/MCDevNightSample](https://github.com/C6H2Cl2/MCDevNightSample) -- [therealfarfetchd/build.gradle.kts](https://gist.github.com/therealfarfetchd/db8fc601df89703a360bccc0395ec590) +This mod will make Minecraft to a true space exploration game. diff --git a/gradle.properties b/gradle.properties index 700ceec..903b8cb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ -modGroup=io.github.proudust +modGroup=de.wulkanat.www modVersion=1.0-SNAPSHOT -modBaseName=minecraft-forge-kotlin-template +modBaseName=new-frontiers forgeVersion=1.12.2-14.23.5.2768 mappingVersion=stable_39 diff --git a/src/main/kotlin/io/github/proudust/minecraftforgekotlintemplate/MinecraftForgeKotlinTemplate.kt b/src/main/kotlin/de/wulkanat/www/newfrontiers/NewFrontiers.kt similarity index 61% rename from src/main/kotlin/io/github/proudust/minecraftforgekotlintemplate/MinecraftForgeKotlinTemplate.kt rename to src/main/kotlin/de/wulkanat/www/newfrontiers/NewFrontiers.kt index 3425336..9e8ff79 100644 --- a/src/main/kotlin/io/github/proudust/minecraftforgekotlintemplate/MinecraftForgeKotlinTemplate.kt +++ b/src/main/kotlin/de/wulkanat/www/newfrontiers/NewFrontiers.kt @@ -1,24 +1,28 @@ -package io.github.proudust.minecraftforgekotlintemplate +package de.wulkanat.www.newfrontiers +import de.wulkanat.www.newfrontiers.blocks.NFBlock +import de.wulkanat.www.newfrontiers.blocks.SpaceTeleporter import net.minecraft.block.Block import net.minecraft.item.Item +import net.minecraft.item.ItemBlock import net.minecraftforge.event.RegistryEvent import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.common.event.FMLInitializationEvent import net.minecraftforge.fml.common.event.FMLPostInitializationEvent import net.minecraftforge.fml.common.event.FMLPreInitializationEvent import net.minecraftforge.fml.common.eventhandler.SubscribeEvent +import net.minecraftforge.fml.common.registry.GameRegistry @Mod( - modid = MinecraftForgeKotlinTemplate.MOD_ID, - name = MinecraftForgeKotlinTemplate.MOD_NAME, - version = MinecraftForgeKotlinTemplate.VERSION, + modid = NewFrontiers.MOD_ID, + name = NewFrontiers.MOD_NAME, + version = NewFrontiers.VERSION, modLanguageAdapter = "net.shadowfacts.forgelin.KotlinAdapter" ) -object MinecraftForgeKotlinTemplate { - const val MOD_ID = "minecraft-forge-kotlin-template" - const val MOD_NAME = "Minecraft Forge Kotlin Template" - const val VERSION = "2019.1-1.2.23" +object NewFrontiers { + const val MOD_ID = "new-frontiers" + const val MOD_NAME = "New Frontiers" + const val VERSION = "1.0-SNAPSHOT" /** * This is the first initialization event. Register tile entities here. @@ -34,7 +38,6 @@ object MinecraftForgeKotlinTemplate { */ @Mod.EventHandler fun init(event: FMLInitializationEvent) { - } /** @@ -48,37 +51,35 @@ object MinecraftForgeKotlinTemplate { /** * This is a special class that listens to registry events, to allow creation of mod blocks and items at the proper time. */ - @Mod.EventBusSubscriber + @Mod.EventBusSubscriber(modid = MOD_ID) object ObjectRegistryHandler { + private val blocks: Array = arrayOf( + SpaceTeleporter(MOD_ID, "space_teleporter") + ) + /** * Listen for the register event for creating custom items */ @SubscribeEvent + @JvmStatic fun addItems(event: RegistryEvent.Register) { - /* - event.registry.register(ItemBlock(MySpecialBlock).setRegistryName(MOD_ID, "myBlock")) - event.registry.register(MySpecialItem.setRegistryName(MOD_ID, "mySpecialItem")) - */ + for (block in blocks) { + if (block.hasItemBlock) { + event.registry.register(ItemBlock(block).setRegistryName(block.registryName)) + } + } + // TODO: register items } /** * Listen for the register event for creating custom blocks */ @SubscribeEvent + @JvmStatic fun addBlocks(event: RegistryEvent.Register) { - /* - event.registry.register(MySpecialBlock.setRegistryName(MOD_ID, "mySpecialBlock")) - */ + for (block in blocks) { + event.registry.register(block) + } } } - - /* EXAMPLE ITEM AND BLOCK - you probably want these in separate files - object MySpecialItem : Item() { - - } - - object MySpecialBlock : Block() { - - } - */ } diff --git a/src/main/kotlin/de/wulkanat/www/newfrontiers/StaticValues.kt b/src/main/kotlin/de/wulkanat/www/newfrontiers/StaticValues.kt new file mode 100644 index 0000000..fe05282 --- /dev/null +++ b/src/main/kotlin/de/wulkanat/www/newfrontiers/StaticValues.kt @@ -0,0 +1,5 @@ +package de.wulkanat.www.newfrontiers + +object StaticValues { + +} diff --git a/src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/NFBlock.kt b/src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/NFBlock.kt new file mode 100644 index 0000000..1e0ef75 --- /dev/null +++ b/src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/NFBlock.kt @@ -0,0 +1,8 @@ +package de.wulkanat.www.newfrontiers.blocks + +import net.minecraft.block.Block +import net.minecraft.block.material.Material + +abstract class NFBlock(material: Material) : Block(material) { + val hasItemBlock = true +} diff --git a/src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/SpaceTeleporter.kt b/src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/SpaceTeleporter.kt new file mode 100644 index 0000000..4f01045 --- /dev/null +++ b/src/main/kotlin/de/wulkanat/www/newfrontiers/blocks/SpaceTeleporter.kt @@ -0,0 +1,13 @@ +package de.wulkanat.www.newfrontiers.blocks + +import net.minecraft.block.material.Material +import net.minecraft.creativetab.CreativeTabs + +class SpaceTeleporter(modid: String, name: String) : NFBlock(Material.GROUND) { + init { + setHardness(1.5F) + setResistance(2.5F) + setRegistryName("$modid:$name") + creativeTab = CreativeTabs.BUILDING_BLOCKS + } +} diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index 557f187..e6c61d0 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,8 +1,8 @@ [ { - "modid": "minecraft-forge-kotlin-template", - "name": "Minecraft Forge Kotlin Template", - "description": "injection point type '%s'", + "modid": "new-frontiers", + "name": "New Frontiers", + "description": "Make Minecraft a true Space Exploation Game", "version": "${version}", "mcversion": "${mcversion}", "url": "",