net.kernelpanicsoft.archie.util¶
Types¶
ClickEventBuilder¶
class ClickEventBuilder
ComponentBuilder¶
class ComponentBuilder
ComponentBuilderDsl¶
@DslMarker
annotation class ComponentBuilderDsl
HoverEventBuilder¶
class HoverEventBuilder
MutableEntry¶
StyleBuilder¶
class StyleBuilder
Properties¶
clothConfigModId¶
val clothConfigModId: String
Cloth Config's own mod id, which differs by loader: Fabric allows hyphens ("cloth-config"), while NeoForge's mod id charset doesn't, so its variant registers as "cloth_config" instead.
hasMinecraftClient¶
Whether there is a real Minecraft behind this physical client yet - see withMinecraftClient, which is how you should almost always spend this.
hasMinecraftServer¶
Whether a MinecraftServer is running - integrated or dedicated alike, since a single-player client has one just as truly as a server jar does. See withMinecraftServer, which is how you should almost always spend this.
isClient¶
isClothConfigLoaded¶
Whether Cloth Config is actually present among the currently loaded mods - not merely whether this is the physical client. onClient alone only rules out a dedicated server; it still lets client-only code run on a client that simply doesn't have Cloth Config installed, which is exactly the case any code touching Cloth Config's own types (ModifierKeyCode and friends) needs to additionally guard against to avoid a hard dependency on it.
isServer¶
minecraftClient¶
val minecraftClient: Minecraft?
The running Minecraft, or null where there is none.
minecraftServer¶
val minecraftServer: MinecraftServer?
requireMinecraftClient¶
val requireMinecraftClient: Minecraft
The running Minecraft, for code that cannot execute without one - drawing a widget, handling a click, reading the options behind a tooltip.
requireMinecraftServer¶
val requireMinecraftServer: MinecraftServer
The running MinecraftServer, for code that cannot execute without one - a block entity tick, a command, anything reached from a ServerLevel.
Functions¶
blockEntityType¶
fun <T : BlockEntity> blockEntityType(factory: BlockEntityType.BlockEntitySupplier<T>, builder: MutableList<Block>.() -> Unit): BlockEntityType<T>
Builds a BlockEntityType for factory, valid for the set of Blocks declared via builder (e.g. { add(MyBlocks.MY_BLOCK.get()) }).
blockProperties¶
fun blockProperties(parent: BlockBehaviour? = null, block: BlockBehaviour.Properties.() -> Unit): BlockBehaviour.Properties
Builds a BlockBehaviour.Properties via block, optionally starting from a full copy of parent's properties instead of the defaults.
buildArray¶
inline fun <T> buildArray(builderAction: MutableList<T>.() -> Unit): Array<T>
Builds a reference Array of T using the buildList DSL via builderAction.
inline fun <T> buildArray(capacity: Int, builderAction: MutableList<T>.() -> Unit): Array<T>
Like buildArray, but pre-sizes the backing list to capacity.
buildComponent¶
inline fun buildComponent(builderAction: ComponentBuilder.() -> Unit): Component
buildStyle¶
inline fun buildStyle(builderAction: StyleBuilder.() -> Unit): Style
div¶
Appends /[other] to this location's path.
operator fun ResourceLocation.div(other: ResourceLocation): ResourceLocation
foldEnv¶
Runs client on the physical client and server on a dedicated server, returning whichever ran. Only the branch matching the current Env is ever class-loaded, so client can safely reference client-only classes even when this is called from common code.
getReflection¶
Reads a private/inaccessible declared field named field off instance via reflection, searching T and its superclasses.
getReflection¶
Extension form of getReflection; reads field (searching up the class hierarchy) from this instance.
invoke¶
inline operator fun Component.invoke(builderAction: ComponentBuilder.() -> Unit): Component
itemProperties¶
fun itemProperties(block: Item.Properties.() -> Unit): Item.Properties
Builds an Item.Properties via block.
onClient¶
Runs client and returns its result, only on the physical client; returns Optional.empty on a dedicated server without ever class-loading client.
onServer¶
Runs server and returns its result, only on a dedicated server; returns Optional.empty on the physical client without ever class-loading server.
plus¶
Appends other directly to this location's path with no separator, e.g. loc + "_dark".
operator fun ResourceLocation.plus(other: ResourceLocation): ResourceLocation
Appends other's path directly to this location's path with no separator (namespace of other is ignored).
rem¶
Builds a ResourceLocation namespaced under this Mod's id, with other as the path, e.g. MyMod.MOD % "my_item".
Builds a ResourceLocation with this as the namespace and other as the path, e.g. "mymod" % "my_item".
Builds a ResourceLocation namespaced under Archie.MOD_ID, with other as the path, e.g. Archie % "main".
sendSystemMessage¶
inline fun Player.sendSystemMessage(builderAction: ComponentBuilder.() -> Unit)
setReflection¶
Writes value to a private/inaccessible declared field named field on instance via reflection, searching T and its superclasses.
setReflection¶
Extension form of setReflection; writes field (searching up the class hierarchy) on this instance.
tab¶
fun Item.Properties.tab(tab: DeferredSupplier<CreativeModeTab>): Item.Properties
Assigns tab as this item's creative tab, via Architectury's injected item-properties extension.
fun Item.Properties.tab(tab: ResourceKey<CreativeModeTab>): Item.Properties
Assigns tab as this item's creative tab, via Architectury's injected item-properties extension.
fun Item.Properties.tab(tab: CreativeModeTab): Item.Properties
Assigns tab as this item's creative tab, via Architectury's injected item-properties extension.
withMinecraftClient¶
inline fun withMinecraftClient(crossinline block: Minecraft.() -> Unit)
Runs block against the running Minecraft, on the physical client and only once there is a game to run it against - see withMinecraftServer for the server-side counterpart.
withMinecraftServer¶
inline fun withMinecraftServer(crossinline block: MinecraftServer.() -> Unit)
Runs block against the running MinecraftServer, if there is one.