Resolve Cyclic Dependency

This commit is contained in:
2020-03-22 21:44:07 +01:00
parent 62c653ed7f
commit d389000bc7
28 changed files with 510 additions and 105 deletions

124
.idea/uiDesigner.xml generated Normal file
View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

View File

@@ -1,19 +0,0 @@
package de.wulkanat.www.new_frontiers
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.init.Blocks
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.relauncher.Side
import net.minecraftforge.fml.relauncher.SideOnly
class NFCreativeTabs : CreativeTabs("new_frontiers") {
override fun getTabLabel(): String {
return "new_frontiers"
}
@SideOnly(Side.CLIENT)
override fun createIcon(): ItemStack {
return ItemStack(Item.getItemFromBlock(NewFrontiers.ObjectRegistryHandler.blocks[0]))
}
}

View File

@@ -1,14 +1,13 @@
package de.wulkanat.www.new_frontiers
import de.wulkanat.www.new_frontiers.blocks.FTLDrive
import de.wulkanat.www.new_frontiers.blocks.NFBlock
import de.wulkanat.www.new_frontiers.blocks.SpaceTeleporter
import de.wulkanat.www.new_frontiers.dimensions.Space
import de.wulkanat.www.new_frontiers.init.Blocks
import de.wulkanat.www.new_frontiers.init.Items
import de.wulkanat.www.new_frontiers.init.registerBiomes
import de.wulkanat.www.new_frontiers.init.registerDimensions
import net.minecraft.block.Block
import net.minecraft.item.Item
import net.minecraft.item.ItemBlock
import net.minecraft.world.DimensionType
import net.minecraftforge.common.DimensionManager
import net.minecraftforge.client.event.ModelRegistryEvent
import net.minecraftforge.event.RegistryEvent
import net.minecraftforge.fml.common.Mod
import net.minecraftforge.fml.common.event.FMLInitializationEvent
@@ -27,65 +26,56 @@ object NewFrontiers {
const val MOD_NAME = "New Frontiers"
const val VERSION = "1.0-SNAPSHOT"
val NF_CREATIVE_TAB = NFCreativeTabs()
/**
* This is the first initialization event. Register tile entities here.
* The registry events below will have fired prior to entry to this method.
*/
@Mod.EventHandler
fun preinit(event: FMLPreInitializationEvent) {
val a = DimensionType.register("Space", "_space", 2, Space::class.java, false)
DimensionManager.registerDimension(2, a)
// TODO: register world generator
registerBiomes()
registerDimensions()
// TODO: register entities
}
/**
* This is the second initialization event. Register custom recipes
*/
@Mod.EventHandler
fun init(event: FMLInitializationEvent) {
}
/**
* This is the final initialization event. Register actions from other mods here
*/
@Mod.EventHandler
fun postinit(event: FMLPostInitializationEvent) {
}
/**
* This is a special class that listens to registry events, to allow creation of mod blocks and items at the proper time.
*/
@Mod.EventBusSubscriber(modid = MOD_ID)
object ObjectRegistryHandler {
val blocks: Array<NFBlock> = arrayOf(
SpaceTeleporter(),
FTLDrive()
)
/**
* Listen for the register event for creating custom items
*/
@SubscribeEvent
@JvmStatic
fun addItems(event: RegistryEvent.Register<Item>) {
for (block in blocks) {
if (block.hasItemBlock) {
event.registry.register(ItemBlock(block).setRegistryName(block.registryName))
for (block in Blocks.values()) {
if (block.value.hasItemBlock) {
event.registry.register(ItemBlock(block.value).setRegistryName(block.value.registryName))
}
}
for (item in Items.values()) {
event.registry.register(item.value)
}
}
@SubscribeEvent
@JvmStatic
fun registerModels(even: ModelRegistryEvent) {
for (item in Items.values()) {
if (item.value.hasCustomModel) {
item.value.registerModels()
}
}
// TODO: register items
}
/**
* Listen for the register event for creating custom blocks
*/
@SubscribeEvent
@JvmStatic
fun addBlocks(event: RegistryEvent.Register<Block>) {
for (block in blocks) {
event.registry.register(block)
for (block in Blocks.values()) {
event.registry.register(block.value)
}
}
}

View File

@@ -0,0 +1,53 @@
package de.wulkanat.www.new_frontiers.abstract_helpers
import net.minecraft.block.state.IBlockState
import net.minecraft.world.biome.Biome
import net.minecraftforge.common.BiomeDictionary
import net.minecraftforge.common.BiomeManager
abstract class NFBiome(
val name: String,
val biomeType: BiomeManager.BiomeType,
val types: Array<BiomeDictionary.Type>,
baseHeight: Float = 1.0F,
heightVariation: Float = 1.0F,
temperature: Float = 0.5F,
rainFrequency: Float = 0.6F,
rain: Boolean = true,
snow: Boolean = false,
waterColor: Int = 16711680,
topBlock: IBlockState,
fillerBlock: IBlockState,
spawnableCaveCreatureList: List<SpawnListEntry> = arrayListOf(),
spawnableCreatureList: List<SpawnListEntry> = arrayListOf(),
spawnableMonsterList: List<SpawnListEntry> = arrayListOf(),
spawnableWaterCreatureList: List<SpawnListEntry> = arrayListOf()
) : Biome(setRainAndSnow(BiomeProperties(name)
.setBaseHeight(baseHeight)
.setHeightVariation(heightVariation)
.setTemperature(temperature)
.setRainfall(rainFrequency)
.setWaterColor(waterColor), rain, snow)) {
init {
this.topBlock = topBlock
this.fillerBlock = fillerBlock
this.spawnableCaveCreatureList = spawnableCaveCreatureList
this.spawnableCreatureList = spawnableCreatureList
this.spawnableMonsterList = spawnableMonsterList
this.spawnableWaterCreatureList = spawnableWaterCreatureList
// TODO: decorator
}
companion object {
private fun setRainAndSnow(properties: BiomeProperties, rain: Boolean, snow: Boolean): BiomeProperties {
if (!rain)
properties.setRainDisabled()
if (snow)
properties.setSnowEnabled()
return properties
}
}
}

View File

@@ -1,4 +1,4 @@
package de.wulkanat.www.new_frontiers.blocks
package de.wulkanat.www.new_frontiers.abstract_helpers
import de.wulkanat.www.new_frontiers.NewFrontiers
import net.minecraft.block.Block
@@ -16,7 +16,7 @@ abstract class NFBlock(
lightLevel: Int = 0,
lightOpacity: Int = 0,
name: String,
creativeTabs: CreativeTabs = NewFrontiers.NF_CREATIVE_TAB
creativeTab: CreativeTabs = de.wulkanat.www.new_frontiers.init.CreativeTabs.NF_BLOCKS.value
) : Block(material) {
init {
// The Java code is a lot of hot garbage, so most of this is copied from the setter functions
@@ -31,7 +31,7 @@ abstract class NFBlock(
this.translationKey = name
this.lightValue = lightLevel
this.lightOpacity = lightOpacity
this.creativeTab = creativeTabs
this.creativeTab = creativeTab
}
override fun isCollidable(): Boolean {

View File

@@ -0,0 +1,27 @@
package de.wulkanat.www.new_frontiers.abstract_helpers
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.item.Item
import net.minecraft.item.ItemStack
import net.minecraftforge.fml.relauncher.Side
import net.minecraftforge.fml.relauncher.SideOnly
abstract class NFCreativeTabs(
val name: String,
val tabIcon: () -> Item,
tabBackground: String? = null
) : CreativeTabs(name) {
init {
if (tabBackground != null)
backgroundImageName = tabBackground
}
override fun getTabLabel(): String {
return name
}
@SideOnly(Side.CLIENT)
override fun createIcon(): ItemStack {
return ItemStack(tabIcon())
}
}

View File

@@ -0,0 +1,34 @@
package de.wulkanat.www.new_frontiers.abstract_helpers
import net.minecraft.world.DimensionType
import net.minecraft.world.WorldProvider
import net.minecraft.world.biome.BiomeProvider
import net.minecraft.world.gen.IChunkGenerator
abstract class NFDimension(
private val canRespawn: Boolean = true,
private val surfaceDimension: Boolean = false,
val name: String,
val id: Int,
biomeProvider: BiomeProvider
) : WorldProvider() {
init {
this.biomeProvider = biomeProvider
}
private val dimType: DimensionType = DimensionType.register(name, "_${name.toLowerCase()}", id, this.javaClass, false)
override fun getDimensionType(): DimensionType? {
return dimType
}
abstract override fun createChunkGenerator(): IChunkGenerator
override fun canRespawnHere(): Boolean {
return canRespawn
}
override fun isSurfaceWorld(): Boolean {
return surfaceDimension
}
}

View File

@@ -0,0 +1,22 @@
package de.wulkanat.www.new_frontiers.abstract_helpers
import de.wulkanat.www.new_frontiers.NewFrontiers
import de.wulkanat.www.new_frontiers.proxy.registerItemRenderer
import net.minecraft.creativetab.CreativeTabs
import net.minecraft.item.Item
abstract class NFItem(
name: String,
creativeTab: CreativeTabs = de.wulkanat.www.new_frontiers.init.CreativeTabs.NF_ITEMS.value,
val hasCustomModel: Boolean = false
) : Item() {
init {
setRegistryName("${NewFrontiers.MOD_ID}:$name")
this.translationKey = name
this.creativeTab = creativeTab
}
fun registerModels() {
registerItemRenderer(this, 0, "inventory")
}
}

View File

@@ -0,0 +1,18 @@
package de.wulkanat.www.new_frontiers.biomes
import de.wulkanat.www.new_frontiers.abstract_helpers.NFBiome
import net.minecraft.block.BlockClay
import net.minecraft.block.BlockStone
import net.minecraftforge.common.BiomeDictionary
import net.minecraftforge.common.BiomeManager
class BiomeDeepSpace : NFBiome(
name = "deep_space",
biomeType = BiomeManager.BiomeType.COOL,
types = arrayOf(BiomeDictionary.Type.VOID),
rain = false,
snow = false,
temperature = 0F,
topBlock = BlockStone().defaultState,
fillerBlock = BlockClay().defaultState
)

View File

@@ -1,2 +0,0 @@
package de.wulkanat.www.new_frontiers.biomes

View File

@@ -1,8 +1,9 @@
package de.wulkanat.www.new_frontiers.blocks
import de.wulkanat.www.new_frontiers.abstract_helpers.NFBlock
import net.minecraft.block.material.Material
class FTLDrive : NFBlock(
class BlockFTLDrive : NFBlock(
material = Material.ANVIL,
name = "ftl_drive"
)

View File

@@ -1,8 +1,9 @@
package de.wulkanat.www.new_frontiers.blocks
import de.wulkanat.www.new_frontiers.abstract_helpers.NFBlock
import net.minecraft.block.material.Material
class SpaceTeleporter : NFBlock(
class BlockSpaceTeleporter : NFBlock(
material = Material.GROUND,
hardness = 1.5F,
resistance = 2.5F,

View File

@@ -0,0 +1,10 @@
package de.wulkanat.www.new_frontiers.creativetabs
import de.wulkanat.www.new_frontiers.abstract_helpers.NFCreativeTabs
import de.wulkanat.www.new_frontiers.init.Blocks
import net.minecraft.item.Item
class CreativeTabNFBlocks : NFCreativeTabs(
name = "nf_blocks",
tabIcon = { Item.getItemFromBlock(Blocks.SPACE_TELEPORTER.value) }
)

View File

@@ -0,0 +1,9 @@
package de.wulkanat.www.new_frontiers.creativetabs
import de.wulkanat.www.new_frontiers.abstract_helpers.NFCreativeTabs
import de.wulkanat.www.new_frontiers.init.Items
class CreativeTabNFItems : NFCreativeTabs(
name = "nf_items",
tabIcon = { Items.TEST_ITEM.value }
)

View File

@@ -0,0 +1,19 @@
package de.wulkanat.www.new_frontiers.dimensions
import de.wulkanat.www.new_frontiers.abstract_helpers.NFDimension
import de.wulkanat.www.new_frontiers.dimensions.chunkgen.VoidChunkGenerator
import de.wulkanat.www.new_frontiers.init.Biomes
import net.minecraft.world.biome.BiomeProviderSingle
import net.minecraft.world.gen.IChunkGenerator
class DimensionSpace : NFDimension(
name = "space",
id = 2,
canRespawn = true,
surfaceDimension = false,
biomeProvider = BiomeProviderSingle(Biomes.DEEP_SPACE.value)
) {
override fun createChunkGenerator(): IChunkGenerator {
return VoidChunkGenerator(this.world)
}
}

View File

@@ -1,21 +0,0 @@
package de.wulkanat.www.new_frontiers.dimensions
import net.minecraft.world.DimensionType
import net.minecraft.world.WorldProvider
import net.minecraft.world.gen.IChunkGenerator
abstract class NFDimension(
private val canRespawn: Boolean = true,
private val surfaceDimension: Boolean = false
) : WorldProvider() {
abstract override fun getDimensionType(): DimensionType
abstract override fun createChunkGenerator(): IChunkGenerator
override fun canRespawnHere(): Boolean {
return canRespawn
}
override fun isSurfaceWorld(): Boolean {
return surfaceDimension
}
}

View File

@@ -1,17 +0,0 @@
package de.wulkanat.www.new_frontiers.dimensions
import net.minecraft.world.DimensionType
import net.minecraft.world.gen.IChunkGenerator
class Space : NFDimension(
canRespawn = true,
surfaceDimension = false
) {
override fun getDimensionType(): DimensionType {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
override fun createChunkGenerator(): IChunkGenerator {
TODO("not implemented")
}
}

View File

@@ -0,0 +1,40 @@
package de.wulkanat.www.new_frontiers.dimensions.chunkgen
import net.minecraft.entity.EnumCreatureType
import net.minecraft.util.math.BlockPos
import net.minecraft.world.World
import net.minecraft.world.biome.Biome
import net.minecraft.world.chunk.Chunk
import net.minecraft.world.gen.IChunkGenerator
class VoidChunkGenerator(
private val world: World
) : IChunkGenerator {
override fun generateStructures(p0: Chunk, p1: Int, p2: Int): Boolean {
return false
}
override fun getPossibleCreatures(p0: EnumCreatureType, p1: BlockPos): MutableList<Biome.SpawnListEntry> {
return arrayListOf()
}
override fun populate(p0: Int, p1: Int) {
// noop
}
override fun recreateStructures(p0: Chunk, p1: Int, p2: Int) {
// noop
}
override fun getNearestStructurePos(p0: World, p1: String, p2: BlockPos, p3: Boolean): BlockPos? {
return null
}
override fun generateChunk(p0: Int, p1: Int): Chunk {
return Chunk(world, p0, p1)
}
override fun isInsideStructure(p0: World, p1: String, p2: BlockPos): Boolean {
return false
}
}

View File

@@ -0,0 +1,27 @@
package de.wulkanat.www.new_frontiers.init
import de.wulkanat.www.new_frontiers.biomes.BiomeDeepSpace
import de.wulkanat.www.new_frontiers.abstract_helpers.NFBiome
import net.minecraft.world.biome.Biome
import net.minecraftforge.common.BiomeDictionary
import net.minecraftforge.common.BiomeManager
import net.minecraftforge.fml.common.registry.ForgeRegistries
enum class Biomes(val value: NFBiome) {
DEEP_SPACE(BiomeDeepSpace())
}
fun registerBiomes() {
for (biome in Biomes.values()) {
initBiome(biome.value, biome.value.name, biome.value.biomeType, *biome.value.types)
}
}
fun initBiome(biome: Biome, name: String, biomeType: BiomeManager.BiomeType, vararg types: BiomeDictionary.Type): Biome {
biome.setRegistryName(name)
ForgeRegistries.BIOMES.register(biome)
BiomeDictionary.addTypes(biome, *types)
BiomeManager.addBiome(biomeType, BiomeManager.BiomeEntry(biome, 10))
BiomeManager.addSpawnBiome(biome)
return biome
}

View File

@@ -0,0 +1,32 @@
package de.wulkanat.www.new_frontiers.init
import de.wulkanat.www.new_frontiers.blocks.BlockFTLDrive
import de.wulkanat.www.new_frontiers.abstract_helpers.NFBlock
import de.wulkanat.www.new_frontiers.blocks.BlockSpaceTeleporter
enum class Blocks(value: NFBlock) {
SPACE_TELEPORTER(BlockSpaceTeleporter()),
FTL_DRIVE(BlockFTLDrive());
val value: NFBlock by lazy {
value
}
}
class B(val a: String) {
init {
println("B Created")
}
}
class A(a: B) {
val b by lazy {
a
}
}
fun main() {
val a = A(B("something"))
println(a.b)
}

View File

@@ -0,0 +1,10 @@
package de.wulkanat.www.new_frontiers.init
import de.wulkanat.www.new_frontiers.creativetabs.CreativeTabNFBlocks
import de.wulkanat.www.new_frontiers.abstract_helpers.NFCreativeTabs
import de.wulkanat.www.new_frontiers.creativetabs.CreativeTabNFItems
enum class CreativeTabs(val value: NFCreativeTabs) {
NF_BLOCKS(CreativeTabNFBlocks()),
NF_ITEMS(CreativeTabNFItems())
}

View File

@@ -0,0 +1,15 @@
package de.wulkanat.www.new_frontiers.init
import de.wulkanat.www.new_frontiers.dimensions.DimensionSpace
import de.wulkanat.www.new_frontiers.abstract_helpers.NFDimension
import net.minecraftforge.common.DimensionManager
enum class DimensionTypes(val value: NFDimension) {
SPACE(DimensionSpace());
}
fun registerDimensions() {
for (dimensionType in DimensionTypes.values()) {
DimensionManager.registerDimension(dimensionType.value.id, dimensionType.value.dimensionType)
}
}

View File

@@ -0,0 +1,8 @@
package de.wulkanat.www.new_frontiers.init
import de.wulkanat.www.new_frontiers.abstract_helpers.NFItem
import de.wulkanat.www.new_frontiers.items.ItemTestItem
enum class Items(val value: NFItem) {
TEST_ITEM(ItemTestItem())
}

View File

@@ -0,0 +1,7 @@
package de.wulkanat.www.new_frontiers.items
import de.wulkanat.www.new_frontiers.abstract_helpers.NFItem
class ItemTestItem : NFItem(
name = "test_item"
)

View File

@@ -0,0 +1,10 @@
package de.wulkanat.www.new_frontiers.proxy
import net.minecraft.client.renderer.block.model.ModelResourceLocation
import net.minecraft.item.Item
import net.minecraft.util.ResourceLocation
import net.minecraftforge.client.model.ModelLoader
fun registerItemRenderer(item: Item, meta: Int, id: String) {
ModelLoader.setCustomModelResourceLocation(item, meta, ModelResourceLocation(item.registryName as ResourceLocation, id))
}

View File

@@ -1,4 +1,5 @@
tile.space_teleporter.name=Space Teleporter
tile.ftl_drive.name=FTL Drive
itemGroup.new_frontiers=New Frontiers
itemGroup.nf_blocks=New Frontiers Blocks
itemGroup.nf_items=New Frontiers Items

View File

@@ -0,0 +1,6 @@
{
"parent": "item/generated",
"textures": {
"layer0": "new_frontiers:items/test_item"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 262 B