beginning of the neocomputer
This commit is contained in:
19
src/main/kotlin/org/neoflock/neocomputers/NeoComputers.kt
Normal file
19
src/main/kotlin/org/neoflock/neocomputers/NeoComputers.kt
Normal file
@@ -0,0 +1,19 @@
|
||||
package org.neoflock.neocomputers
|
||||
|
||||
import org.slf4j.Logger
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
|
||||
object NeoComputers {
|
||||
const val MODID: String = "neocomputers"
|
||||
val LOGGER: Logger = LoggerFactory.getLogger("NeoComputers")
|
||||
var PLATFORM: ModPlatform? = null
|
||||
|
||||
fun entrypoint(platform: ModPlatform?) {
|
||||
PLATFORM = platform
|
||||
//LOGGER.info("Started mod in %s loader".formatted(NeoComputersInit.PLATFORM.getModloader()))
|
||||
//LOGGER.info("Kotlin: %s".formatted(NeoComputers.hello()))
|
||||
LOGGER.info("Started mod in ${NeoComputers.PLATFORM?.modloader} loader")
|
||||
LOGGER.info("Hello from kotlin!")
|
||||
}
|
||||
}
|
||||
14
src/main/kotlin/org/neoflock/neocomputers/block/BaseBlock.kt
Normal file
14
src/main/kotlin/org/neoflock/neocomputers/block/BaseBlock.kt
Normal file
@@ -0,0 +1,14 @@
|
||||
package org.neoflock.neocomputers.block
|
||||
|
||||
import net.minecraft.world.level.block.Block
|
||||
|
||||
class BaseBlock : Block {
|
||||
protected val tier: Int
|
||||
constructor(tier: Int): super(Properties.of()) {
|
||||
this.tier = tier
|
||||
}
|
||||
|
||||
public fun getTier(): Int {
|
||||
return tier
|
||||
}
|
||||
}
|
||||
50
src/main/kotlin/org/neoflock/neocomputers/block/Blocks.kt
Normal file
50
src/main/kotlin/org/neoflock/neocomputers/block/Blocks.kt
Normal file
@@ -0,0 +1,50 @@
|
||||
package org.libreflock.neocomputers.block
|
||||
|
||||
import dev.architectury.registry.registries.DeferredRegister
|
||||
import dev.architectury.registry.registries.RegistrySupplier
|
||||
import net.minecraft.core.registries.Registries
|
||||
import net.minecraft.world.item.BlockItem
|
||||
import net.minecraft.world.item.Item
|
||||
import net.minecraft.world.level.block.Block
|
||||
import org.libreflock.neocomputers.item.Items
|
||||
import org.libreflock.neocomputers.item.Tabs
|
||||
import org.neoflock.neocomputers.NeoComputers
|
||||
import org.neoflock.neocomputers.block.BaseBlock
|
||||
import java.util.function.Consumer
|
||||
import java.util.function.Supplier
|
||||
|
||||
object Blocks {
|
||||
val BLOCKS: DeferredRegister<Block?> = DeferredRegister.create(NeoComputers.MODID, Registries.BLOCK)
|
||||
|
||||
|
||||
val CASE: MutableList<RegistrySupplier<Block?>?>? =
|
||||
BaseBlock.register(intArrayOf(0, 1, 2), "case", { tier -> CaseBlock(tier) })
|
||||
|
||||
// public static final RegistrySupplier<Block> CASE0 = BLOCKS.register("case0", () -> new CaseBlock(0));
|
||||
// public static final RegistrySupplier<Block> CASE1 = BLOCKS.register("case1", () -> new CaseBlock(1));
|
||||
// public static final RegistrySupplier<Block> CASE2 = BLOCKS.register("case2", () -> new CaseBlock(2));
|
||||
// public static final RegistrySupplier<Block> CABLE = BLOCKS.register("cable", () -> new CableBlock());
|
||||
val SCREEN: RegistrySupplier<Block?>? = BLOCKS.register<Block?>("screen", Supplier { ScreenBlock() })
|
||||
val CABLE: RegistrySupplier<Block?>? = BLOCKS.register<Block?>("cable", Supplier { CableBlock() })
|
||||
|
||||
fun registerBlockItems() {
|
||||
BLOCKS.forEach(Consumer { sup: RegistrySupplier<Block?>? ->
|
||||
// sup.pre
|
||||
// sup.((blk) -> {
|
||||
// NeoComputers.LOGGER.info(blk.getDescriptionId());
|
||||
// if (blk instanceof BaseBlock) {
|
||||
// Items.ITEMS.register(sup.getId().getPath(), () -> new BaseBlock.BaseBlockItem(blk, new Item.Properties().arch$tab(Tabs.TAB)));
|
||||
// } else {
|
||||
// Items.ITEMS.register(sup.getId().getPath(), () -> new BlockItem(blk, new Item.Properties().arch$tab(Tabs.TAB)));
|
||||
// }
|
||||
// });
|
||||
Items.ITEMS.register(sup!!.getId().getPath(), {
|
||||
if (sup.get() is BaseBlock) {
|
||||
return@register BaseBlockItem(sup.get(), Item.Properties().`arch$tab`(Tabs.TAB))
|
||||
} else {
|
||||
return@register BlockItem(sup.get(), Item.Properties().`arch$tab`(Tabs.TAB))
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user