my bad mixin night vision
build / build (push) Successful in 6m14s

This commit is contained in:
2026-07-17 13:07:33 +02:00
parent 02eed23681
commit 31fdc4791e
3 changed files with 113 additions and 4 deletions
@@ -1,21 +1,26 @@
package gamer.noir.curseenc
import gamer.noir.curseenc.command.ModCommands
import gamer.noir.curseenc.data.ModComponents
import gamer.noir.curseenc.effect.Effect
import gamer.noir.curseenc.item.ModItems
import net.fabricmc.api.ModInitializer
import org.slf4j.LoggerFactory
object CurseOfEienNoChi : ModInitializer {
private val logger = LoggerFactory.getLogger("curse-of-eien-no-chi")
const val MOD_ID = "curseenc"
val LOGGER = LoggerFactory.getLogger(MOD_ID)
override fun onInitialize() {
ModItems.initialize()
Effect.initialize()
// This code runs as soon as Minecraft is in a mod-load-ready state.
ModCommands.initialize()
ModComponents.initialize() // This code runs as soon as Minecraft is in a mod-load-ready state.
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.
logger.info("Hello Fabric world!")
LOGGER.info("Hello Fabric world!")
}
}
@@ -0,0 +1,76 @@
package gamer.noir.curseenc.command
import com.mojang.brigadier.CommandDispatcher
import com.mojang.brigadier.arguments.BoolArgumentType
import com.mojang.brigadier.arguments.IntegerArgumentType
import com.mojang.brigadier.arguments.StringArgumentType
import com.mojang.brigadier.context.CommandContext
import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback
import net.minecraft.commands.CommandBuildContext
import net.minecraft.commands.CommandSourceStack
import net.minecraft.commands.Commands
import net.minecraft.commands.Commands.CommandSelection
import net.minecraft.network.chat.Component
import java.util.function.Supplier
object ModCommands {
private fun executeClass(context: CommandContext<CommandSourceStack?>): Int {
context.getSource()!!.sendSuccess( { Component.literal("C'est pas encore codé du con") }, false)
return 1
}
private fun executePowerAdd(context: CommandContext<CommandSourceStack?>): Int {
context.getSource()!!.sendSuccess( { Component.literal("Power !!!") }, false)
return 1
}
private fun executePowerRemove(context: CommandContext<CommandSourceStack?>): Int {
context.getSource()!!.sendSuccess( { Component.literal("Power !!!") }, false)
return 1
}
private fun executePowerQuary(context: CommandContext<CommandSourceStack?>): Int {
val Power = StringArgumentType.getString(context, "Power")
context.getSource()!!.sendSuccess( { Component.literal("Power $Power is ") }, false)
return 1
}
val argument_power = Commands.argument("Power", StringArgumentType.string()).suggests { context, builder ->
builder.suggest("Night_vision")
.suggest("Hyper_speed")
.suggest("Bat_mod")
.suggest("...")
builder.buildFuture()
}
fun initialize() {
CommandRegistrationCallback.EVENT.register(CommandRegistrationCallback { dispatcher: CommandDispatcher<CommandSourceStack?>?, registryAccess: CommandBuildContext?, environment: CommandSelection? ->
dispatcher!!.register(
Commands.literal("curseenc")
.then(Commands.literal("power")
.then(Commands.literal("add")
.then(argument_power
.executes(ModCommands::executePowerAdd)))
.then(Commands.literal("remove")
.then(argument_power
.executes(ModCommands::executePowerRemove)))
.then(Commands.literal("quary")
.then(argument_power
.executes(ModCommands::executePowerQuary)))
)
.then(Commands.literal("class")
.executes(ModCommands::executeClass))
)
})
}
}
@@ -0,0 +1,28 @@
package gamer.noir.curseenc.data
import com.mojang.serialization.Codec
import gamer.noir.curseenc.CurseOfEienNoChi
import net.minecraft.core.Registry
import net.minecraft.core.component.DataComponentType
import net.minecraft.core.registries.BuiltInRegistries
import net.minecraft.resources.ResourceLocation
object ModComponents {
val CLICK_COUNT_COMPONENT: DataComponentType<Int?>? = Registry.register(
BuiltInRegistries.DATA_COMPONENT_TYPE,
ResourceLocation.fromNamespaceAndPath(CurseOfEienNoChi.MOD_ID, "click_count"),
DataComponentType.builder<Int?>().persistent(Codec.INT).build()
)
internal fun initialize() {
CurseOfEienNoChi.LOGGER.info("Registering {} components", CurseOfEienNoChi.MOD_ID)
// Technically this method can stay empty, but some developers like to notify
// the console, that certain parts of the mod have been successfully initialized
}
}