Add test Block

This commit is contained in:
2020-03-21 19:49:18 +01:00
parent c1f4afebb6
commit 889dae1700
8 changed files with 67 additions and 92 deletions

6
.idea/encodings.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/gradle.properties" charset="UTF-8" />
</component>
</project>

View File

@@ -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 <your_project_name>
cd <your_project_name>
rm -rf .git
```
### Install dependencies
```sh
./gradlew build
```
### Fix properties
**gradle.properties**
```
modGroup=<your_package_name>
modVersion=<your_project_version>
modBaseName=<your_project_name>
```
**mcmod.info**
```json
{
"modid": "<your_package_name>",
"name": "<Your Project Name>",
}
```
**MinecraftForgeKotlinTemplate.kt**
```kt
package <your_package_name>.<your_project_name>
//...
object <YourProjectName> {
const val MOD_ID = <your_project_name>
const val MOD_NAME = <Your Project Name>
const val VERSION = <your_project_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.

View File

@@ -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

View File

@@ -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<NFBlock> = arrayOf(
SpaceTeleporter(MOD_ID, "space_teleporter")
)
/**
* Listen for the register event for creating custom items
*/
@SubscribeEvent
@JvmStatic
fun addItems(event: RegistryEvent.Register<Item>) {
/*
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<Block>) {
/*
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() {
}
*/
}

View File

@@ -0,0 +1,5 @@
package de.wulkanat.www.newfrontiers
object StaticValues {
}

View File

@@ -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
}

View File

@@ -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
}
}

View File

@@ -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": "",