
Ornithe Standard Libraries
Набор библиотек для моддинга Minecraft на загрузчике Ornithe. OSL предоставляет инструменты для событий, конфигов, клавиш, ресурсов и многого другого.
Список изменений
Ornithe Standard Libraries 0.20.0
OSL 0.20.0 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.
Core 0.9.0
Added new registry utilities for the Blocks and Items APIs.
Blocks 0.1.0
The Blocks API provides events and utilities for registering blocks.
Events
REGISTER_BLOCKS: this event is invoked right after Vanilla block registration is completed. Mods should register blocks in listeners to this event.
Block Registry
The BlockRegistry class provides public access to the block registry, including a helper method for registering blocks.
int getId(Block)
NamespacedIdentifier getKey(Block)
Block getBlock(int)
Block getBlock(NamespacedIdentifier)
Set<NamespacedIdentifier> keySet()
// 17w46a-
Block register(int, NamespacedIdentifier, Block)
// 17w47a+
Block register(NamespacedIdentifier, Block)
Block Extension
This API extends the Block class with some functionality from later Minecraft versions.
- Added
boolean isAir()method in 17w46a and below. - Added
boolean is(Block)method in 1.6.4 and below.
Usage
package com.example;
import net.ornithemc.osl.blocks.api.BlockEvents;
import net.ornithemc.osl.entrypoints.api.ModInitializer;
public class ExampleInitializer implements ModInitializer {
@Override
public void init() {
BlockEvents.REGISTER_BLOCKS.register(ExampleBlocks::init);
}
}
package com.example;
import net.minecraft.block.Block;
import net.ornithemc.osl.blocks.api.BlockRegistry;
import net.ornithemc.osl.core.util.NamespacedIdentifiers;
public final class ExampleBlocks {
public static final CookieBlock COOKIE = BlockRegistry.register(NamespacedIdentifiers.from("example", "cookie"), new CookieBlock());
public static void init() {
}
}
Items 0.1.0
The Items API provides events and utilities for registering items.
Events
REGISTER_ITEMS: this event is invoked right after Vanilla item registration is completed. Mods should register items in listeners to this event.REGISTER_BLOCK_ITEMS(for 1.6.4 and below only): this event is invoked right after Vanilla block item registration is completed. Mods should register block items in listeners to this event.
Item Registry
The ItemRegistry class provides public access to the item registry, including helper methods for registering items.
int getId(Item)
NamespacedIdentifier getKey(Item)
Item getItem(int)
Item getItem(NamespacedIdentifier)
Set<NamespacedIdentifier> keySet()
Item register(Block)
Item register(Block, Item)
Item register(BlockItem)
// 17w46a-
Item register(int, NamespacedIdentifier, Item)
// 17w47a+
Item register(NamespacedIdentifier, Item)
Usage
package com.example;
import net.ornithemc.osl.entrypoints.api.ModInitializer;
import net.ornithemc.osl.items.api.ItemEvents;
public class ExampleInitializer implements ModInitializer {
@Override
public void init() {
ItemEvents.REGISTER_ITEMS.register(ExampleItems::init);
}
}
package com.example;
import net.minecraft.item.Item;
import net.ornithemc.osl.core.util.NamespacedIdentifiers;
import net.ornithemc.osl.items.api.ItemRegistry;
public final class ExampleItems {
public static final CookieItem COOKIE = ItemRegistry.register(NamespacedIdentifiers.from("example", "cookie"), new CookieItem());
public static void init() {
}
}
Keybinds 0.3.0
Keybinds API V2 is a minor rewrite of the Keybinds API. The API V1 is still present, but deprecated.
Events
REGISTER_KEYBINDS: this event is invoked upon game start-up, right after Vanilla keybinds have been initialized. Mods should register keybinds in listeners to this event.
Keybind Registry
The KeybindRegistry class provides public access to the keybind registry, including helper methods for registering keybinds.
Set<String> getCategories()
register(
String: name,
int: defaultKeyCode,
String: category
)
// 17w43a+
register(
String: name,
InputConstants.Type: type,
int: defaultKeyCode,
String: category
)
register(KeyBinding)
Usage
package com.example;
import net.ornithemc.osl.entrypoints.api.client.ClientModInitializer;
import net.ornithemc.osl.keybinds.api.KeybindEvents;
public class ExampleInitializer implements ClientModInitializer {
@Override
public void initClient() {
KeybindEvents.REGISTER_KEYBINDS.register(ExampleKeybinds::init);
}
}
package com.example;
import org.lwjgl.glfw.GLFW;
import net.minecraft.client.options.KeyBinding;
import net.ornithemc.osl.keybinds.api.KeybindRegistry;
public final class ExampleKeybinds {
public static final KeyBinding COOKIE = KeybindRegistry.register("cookie", GLFW.GLFW_KEY_Z, "example");
public static void init() {
}
}
