All Mods Resource Packs Data Packs Shaders Modpacks Plugins
Ornithe Standard Libraries

Ornithe Standard Libraries

by Unknown • Downloads: 0 • Followers: 0
Description
Gallery
Changelog
Versions

Ornithe Standard Libraries (OSL) provides tools for modding with Ornithe.

Libraries

Core API

The Core API provides common utilities used by other modules, such as an events system and registries.

Blocks API

The Blocks API provides events and utilities for creating custom blocks.

Branding API

This module patches the title screen with mod loader information in 16w05a and below, emulating what you would see in 16w05b and above. This is done by parsing the run args for the versionType option.

Config API

The Config API provides a framework for building and storing mod configs.

Entrypoints API

The Entrypoints API allows mod developers to submit entrypoints that are called before the game is initialized.

Executors API

This module patches the game instance so it can be used as an Executor, and provides a background executor service for background tasks.

Items API

The Items API provides events and utilities for creating custom items.

Keybinds API

The keybinds API provides events for registering keybinds.

Lifecycle Events API

The Lifecycle Events API provides events to track the lifecycle of the Minecraft client and server.

Localization

The Localization API provides utilities for localizing text and handles loading in mods' translation files.

Networking API

The Networking API provides a framework for client-server communication.

Resource Loader API

The Resource Loader API allows mods to load their own resources into the game.

Text Components API

This module provides an alternative to Minecraft's Text components.

Information for developers

Our Ploceus gradle plugin provides helper methods for adding OSL dependencies to your projects:

dependencies {
    ...
    ploceus.dependOsl('0.20.1')
}

You can also add dependencies on individual OSL modules:

dependencies {
    ...
    ploceus.dependOslModule('0.20.1', 'core')
    ploceus.dependOslModule('0.20.1', 'entrypoints')
}

All Versions

+ Add Version
Name Game version Platforms Published Downloads Actions
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +326
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.9.3-pre3 1.2.x 1.1 +27
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
19w14b 19w14a 19w13b +272
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
1.2.x 1.1 1.0 +49
Ornithe
21h ago 1
1.2.x 1.1 1.0 +26
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
18w33a 18w32a 18w31a +238
Ornithe
21h ago 1
# Ornithe Standard Libraries 0.22.2

OSL 0.22.2 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Block States 0.1.1

Fixed module for 15w47a-1.9.3-pre1 not loading, which prevented the Blocks and Items APIs to load for these versions as well.

## Localization 0.1.3

Fixed server-side translations in 1.1-1.5.

## Items 0.3.1

Fixed ClassNotFoundException in b1.9-pre3.

# Ornithe Standard Libraries 0.22.1

OSL 0.22.1 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Changes

OSL now bundles [Conditional Mixin](https://github.com/OrnitheMC/conditional-mixin/) 1.0.0.

## Entities 0.1.1

Fixes a crash in Alpha 1.1.x.
  • note: to fix the crash, a Vanilla multiplayer bug was fixed where all sheep and cows appear as chickens on the client.
# Ornithe Standard Libraries 0.22.0

OSL 0.22.0 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Core 0.11.0

### Direction and BlockPos

The Core API now provides its own Direction enum and BlockPos class. These provide the same functionality as the equivalent Vanilla classes in 1.8 and above, but are available for all supported Minecraft versions. They are utilized by the new Block States API in 1.7 and below.

## Registries 0.2.0

### Registry Keys

Expanded the RegistryKeys class with registry keys for biome, block entity, and entity registries.

### Legacy String IDs

Namespaced IDs were introduced in 1.7 for blocks and items, and were slowly adopted for other registries in subsequent updates. Namespaced IDs are all lowercase and use snake\_case. Legacy String IDs were not namespaced and were usually PascalCase instead. These legacy IDs cannot be used as namespaced IDs without some form of conversion.

The LegacyStringIds class provides methods to convert between namespaced IDs and the legacy format String IDs.

For legacy ID -> namespaced ID conversion, this means:
  • Converting strings from PascalCase to snake\_case. Consecutive uppercase letters are assumed to be an abbreviation and stick together: TNTMinecart -> tnt_minecart.
  • A .-separated prefix is assumed to be a namespace: example.Cookie -> example:cookie. If the ID has no such prefix, the minecraft namespace is assumed.

For namespaced ID -> legacy ID conversion, this means:
  • Converting strings from snake\_case to PascalCase: minecart_tnt -> MinecartTnt.
  • Namespaces are prefixed to the ID, separated by a .-character: example:cookie -> example.Cookie. For IDs with the minecraft namespace no prefix is attached.

### Registry Sync

  • Added new built-in ID-mapper: DynamicInt2ObjectMapMapper, for maps whose contents may change throughout a world session.
  • When remapping registries, old numerical ID values will be re-used when possible, preventing unnecessary increase of numerical ID values.
  • Improved logging of errors during remapping.

## Block States 0.1.0

The Block States API implements block states in 1.7.10 and below, and extends functionality in 1.8 and above.

### Block States in 1.7.10-

  • Many methods in Block that take in int parameters for block data values, directions and coordinates, are deprecated in favor of equivalent methods that take in BlockState, Direction, and BlockPos parameters.
  • The WorldView, WorldChunk, and WorldChunkSection classes have been extended with BlockState getters and setters.
  • A StatefulBlock implementation is provided that forwards calls to the deprecated methods to the equivalent methods that use block states.
  • The chunk format is not modified whatsoever. The block state getters and setters convert block states to/from block IDs and block data values and call the existing block ID and block data value getters and setters.

example usage:

``java
package com.example;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.world.World;

import net.ornithemc.osl.blockstates.api.block.StatefulBlock;
import net.ornithemc.osl.blockstates.api.state.BlockState;
import net.ornithemc.osl.blockstates.api.state.StateDefinition;
import net.ornithemc.osl.blockstates.api.state.property.BooleanProperty;
import net.ornithemc.osl.blockstates.api.state.property.IntegerProperty;
import net.ornithemc.osl.core.api.util.math.BlockPos;

public class CookieBlock extends StatefulBlock {

public static final IntegerProperty BITES_TAKEN = IntegerProperty.of("bites_taken", 0, 7);
public static final BooleanProperty BAKED = BooleanProperty.of("baked");

public CookieBlock() {
super(Material.COOKIE);
}

@Override
public void buildStateDefinition(StateDefinition.Builder<Block, BlockState> builder) {
builder.add(BITES_TAKEN, BAKED);
}

@Override
public BlockState getStateFromMetadata(int metadata) {
int bitesTaken = metadata & 0x7
boolean baked = (metadata & 0x8) != 0;

return this.defaultState()
.set(BITES_TAKEN, bitesTaken)
.set(BAKED, baked);
}

@Override
public int getMetadataFromState(BlockState state) {
int bitesTaken = state.get(BITES_TAKEN);
int baked = state.get(BAKED) ? 0x8 : 0;

return baked | bitesTaken;
}

@Override
public void onAdded(World world, BlockPos pos, BlockState state) {
...
}

@Override
public void onRemoved(World world, BlockPos pos, BlockState state) {
...
}
}
`

### Block States in 1.8+

  • In 1.8, many methods are added that forward calls to equivalent methods in Block (Vanilla did not do this until 1.9)
  • In 1.12 and below, several methods are added that do exist in 1.13+, like isAir, ticksRandomly, canBePlaced, onAdded, onRemoved, and more.

## Blocks 0.3.0

Moved
Block functionality extensions into the Block States API.

## Items 0.3.0

### Fixes

  • Fixes item model cache resetting when leaving a world or server, leading to corrupted GUI item textures when joining another world or server.

## Block Entities 0.1.0

Basic APIs for registering block entity types.

`java
package com.example;

import net.ornithemc.osl.blockentities.api.BlockEntityEvents;
import net.ornithemc.osl.entrypoints.api.ModInitializer;

public class ExampleInitializer implements ModInitializer {

@Override
public void init() {
BlockEntityEvents.REGISTER_BLOCK_ENTITY_TYPES.register(ExampleBlockEntityTypes::init);
}
}
`

`java
package com.example;

import net.minecraft.block.entity.BlockEntityType;

import net.ornithemc.osl.blockentities.api.BlockEntityTypeRegistry;
import net.ornithemc.osl.blockentities.api.BlockEntityTypes;
import net.ornithemc.osl.core.util.NamespacedIdentifiers;

public final class ExampleBlockEntityTypes {

public static final BlockEntityType<CookieBlockEntity> COOKIE = BlockEntityTypeRegistry.register(NamespacedIdentifiers.from("example", "cookie"), BlockEntityTypes.builder(CookieBlockEntity::new, ExampleBlocks.COOKIE));

public static void init() {
}
}
`

## Block Entities Rendering 0.1.0

Basic APIs for registering block entity renderers.

`java
package com.example;

import net.ornithemc.osl.blockentities.api.client.BlockEntityRenderingEvents;
import net.ornithemc.osl.entrypoints.api.client.ClientModInitializer;

public class ExampleInitializer implements ClientModInitializer {

@Override
public void initClient() {
BlockEntityRenderingEvents.REGISTER_BLOCK_ENTITY_RENDERERS.register(registry -> {
registry.register(CookieBlockEntity.class, CookieBlockRenderer::new);
});
}
}
`

## Entities 0.1.0

Basic APIs for registering entity types.

`java
package com.example;

import net.ornithemc.osl.entities.api.EntityEvents;
import net.ornithemc.osl.entrypoints.api.ModInitializer;

public class ExampleInitializer implements ModInitializer {

@Override
public void init() {
EntityEvents.REGISTER_ENTITY_TYPES.register(ExampleEntityTypes::init);
}
}
`

`java
package com.example;

import net.minecraft.entity.EntityType;
import net.minecraft.entity.living.MobCategory;

import net.ornithemc.osl.entities.api.EntityTypeRegistry;
import net.ornithemc.osl.entities.api.EntityTypes;
import net.ornithemc.osl.core.util.NamespacedIdentifiers;

public final class ExampleEntityTypes {

public static final EntityType<CookieMonsterEntity> COOKIE_MONSTER = EntityTypeRegistry.register(NamespacedIdentifiers.from("example", "cookie_monster"), EntityTypes.builder(CookieMonsterEntity::new, MobCategory.MISC));

public static void init() {
}
}
`

## Entities Rendering 0.1.0

Basic APIs for registering entity renderers.

`java
package com.example;

import net.ornithemc.osl.entities.api.client.EntityRenderingEvents;
import net.ornithemc.osl.entrypoints.api.client.ClientModInitializer;

public class ExampleInitializer implements ClientModInitializer {

@Override
public void initClient() {
EntityRenderingEvents.REGISTER_ENTITY_RENDERERS.register(registry -> {
registry.register(CookieMonsterEntity.class, CookieMonsterRenderer::new);
});
}
}
`

## Biomes 0.1.0

Basic API for registering biomes.

`java
package com.example;

import net.ornithemc.osl.biomes.api.BiomeEvents;
import net.ornithemc.osl.entrypoints.api.ModInitializer;

public class ExampleInitializer implements ModInitializer {

@Override
public void init() {
BiomeEvents.REGISTER_BIOMES.register(ExampleBiomes::init);
}
}
`

`java
package com.example;

import net.minecraft.world.biome.Biome;

import net.ornithemc.osl.biomes.api.BiomeRegistry;
import net.ornithemc.osl.core.util.NamespacedIdentifiers;

public final class ExampleBiomes {

public static final CookieBiome COOKIE = BiomeRegistry.register(NamespacedIdentifiers.from("example", "cookie"), new CookieBiome(new Biome.Settings().setName("Cookie")));

public static void init() {
}
}
`

## Localization 0.1.2

  • Fixes L10n.get` throwing error if no translation exists.
## Ornithe Standard Libraries 0.21.1

OSL 0.21.1 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Networking 0.10.1

### Fixes

  • Fixed memory leaks.
  • Fixed crash when disconnected from the server before login.

## Resource Loader 0.8.1

### Fixes

  • Improve logging of errors when reading pack.mcmeta.
  • Fixes NPEs and crashes when resource pack summary cannot be parsed.

## Text Components 0.1 Alpha 6

The JSON format of OSL text components now supports hex color notation using a # prefix.
# Ornithe Standard Libraries 0.21.0

OSL 0.21.0 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Core 0.10.0

All of the Core API's registry classes (SimpleIdRegistry, DefaultedIdRegistry, IdBiMap) have been deprecated in favor of the new Registries API introduced in this update. They will be removed in a future update.

### Namespaced Identifiers

Namespaced identifiers created through NamespacedIdentifiers factory methods no longer allow uppercase letters ([A-Z]).

``java
NamespacedIdentifiers.from("example", "Thing"); // this will now throw an error
NamespacedIdentifiers.from("example", "thing"); // this is still valid
`

New
prefixed and suffixed methods have been added to create derivative namespaced identifiers with a prefix or suffix.

`java
NamespacedIdentifier id = NamespacedIdentifiers.parse("example:cookie");

NamespacedIdentifier prefixed = id.prefixed("blocks/"); // -> "example:blocks/cookie"
NamespacedIdentifier suffixed = id.suffixed(".json"); // -> "example:cookie.json"
`

## Registries 0.1.0

The Registries API provides an alternative to Vanilla's registry system, with a more modern feature set and available for all Minecraft versions. Not all of Vanilla's registries are registered in the new registry system (only the block and item registries are at this time), but this will change over time as OSL's feature set expands.

This update also provides a Registry Sync API for synchronizing numerical IDs between the server and client and across game sessions, to help avoid network desync and world corruption bugs.

I want to give a shoutout to [Cat Core](https://github.com/thecatcore/), who helped develop and test this API and the accompanying changes in the Blocks and Items APIs.

### Events

The
BOOTSTRAP_REGISTRIES event is fired on game start-up, during bootstrapping. All registries should be loaded before this or in a listener to this event. Bootstrapping registries (i.e. populating their contents) may happen before this, but will be forced right after this event anyway.

`java
RegistryEvents.BOOTSTRAP_REGISTRIES.register(() -> {
...
});
`

### Registries

Registries should be created and registered in your mod's entrypoint:

`java
public class ExampleInitializer implements ModInitializer {

@Override
public void init() {
ExampleRegistries.init();
}
}
`

`java
public final class ExampleRegistries {

public static final ResourceKey<Registry<CookieRecipe>> COOKIE_RECIPE_REGISTRY = RegistryKeys.from(NamespacedIdentifiers.from("example", "cookie_recipe"));

public static final Registry<CookieRecipe> COOKIE_RECIPE = Registries.registerDefaulted(COOKIE_RECIPE_RECIPES, NamespacedIdentifiers.from("example", "chocolate_chip"), CookieRecipes::init);

public static void init() {
}
}
`

`java
public final class CookieRecipes {

public static final CookieRecipe CHOCOLATE_CHIP = Registry.register(ExampleRegistries.COOKIE_RECIPE, NamespacedIdentifiers.from("example", "chocolate_chip"), new ChocolateChipCookieRecipe());

public static void init() {
}
}
`

### Registry Sync

Numerical IDs may be used for serialization in server-client communication or in world saves. If this is the case, you must register your registry to be synchronized.

`java
public final class ExampleRegistries {

public static final ResourceKey<Registry<CookieRecipe>> COOKIE_RECIPE_REGISTRY = RegistryKeys.from(NamespacedIdentifiers.from("example", "cookie_recipe"));

public static final Registry<CookieRecipe> COOKIE_RECIPE = Registries.registerDefaulted(COOKIE_RECIPE_RECIPES, NamespacedIdentifiers.from("example", "chocolate_chip"), CookieRecipes::init);

public static void init() {
SyncedRegistries.register(COOKIE_RECIPE_REGISTRY);
}
}
`

It is not recommended that you use the numerical IDs for any other purposes. If it is unavoidable, however, you can register a custom
IdMapper or IdFixer to ensure there are no network desync or corruption bugs. This API provides several IdMapper implementations you can use, such BooleanArrayMapper, IntArrayMapper, ListMapper, and Int2ObjectMapMapper. You can of course create a custom implementation as well. See below for some examples from OSL's Blocks and Items APIs.

`java
// the
EndermanEntity.HOLDABLE_BLOCKS array uses block IDs as indices to the array!
SyncedRegistries.registerMapper(RegistryKeys.BLOCK, NamespacedIdentifiers.from("block/enderman_holdable"), BooleanArrayMapper.of(() -> EndermanEntity.HOLDABLE_BLOCKS, a -> EndermanEntity.HOLDABLE_BLOCKS = a));
`

`java
// these maps in
ItemModelShaper use item IDs as keys to the map!
SyncedRegistries.registerMapper(RegistryKeys.ITEM, NamespacedIdentifiers.from("item_model_location"), ItemModelRegistryMapper.of(this.models));
SyncedRegistries.registerMapper(RegistryKeys.ITEM, NamespacedIdentifiers.from("item_model"), ItemModelRegistryMapper.of(this.modelCache));
`

## Blocks 0.2.0

Transitioned to the new Registries API and implemented Registry Sync. This comes with some API changes, the biggest of which is the deprecation of the
register(int, NamespacedIdentifier, Block) method in 17w46a and below, in favor of register(NamespacedIdentifier, Block), which automatically assigns a numerical ID to the block.

`diff
  • BlockRegistry.register(999, NamespacedIdentifiers.from("example", "cookie"), new CookieBlock());
++BlockRegistry.register(NamespacedIdentifiers.from("example", "cookie"), new CookieBlock());
`

In versions between 12w07a and 1.6.4 you can pass a special value into the
Block constructor to trigger automatic ID assignment:

`java
BlockRegistry.register(NamespacedIdentifiers.from("example", "cookie"), new CookieBlock(Block.AUTO_ASSIGN_ID));
`

## Items 0.2.0

Transitioned to the new Registries API and implemented Registry Sync. This comes with some API changes, the biggest of which is the deprecation of the
register(int, NamespacedIdentifier, Item) method in 17w46a and below, in favor of register(NamespacedIdentifier, Item), which automatically assigns a numerical ID to the item.

`diff
  • ItemRegistry.register(999, NamespacedIdentifiers.from("example", "cookie"), new CookieItem());
++ItemRegistry.register(NamespacedIdentifiers.from("example", "cookie"), new CookieItem());
`

In versions between 1.6.4 and below you can pass a special value into the
Item constructor to trigger automatic ID assignment:

`java
ItemRegistry.register(NamespacedIdentifiers.from("example", "cookie"), new ItemBlock(Item.AUTO_ASSIGN_ID));
`

## Networking 0.10.0

### Connection Events

Connection events have been overhauled to fix some issues and add more features. For all connection events, listeners now receive a
context object that holds information about the connection. The context objects give access to the following:

`java
ClientConnectionContext {
Minecraft minecraft();

// singleplayer connections only
String worldName();

// multiplayer connections only
String serverAddress();
int serverPort();

// whether the connection is singleplayer
boolean isServerLocal();

// DISCONNECT events only
TextComponent disconnectReason();
}
`
`java
ServerConnectionContext {
MinecraftServer server();
ServerPlayerEntity player();

// DISCONNECT events only
TextComponent disconnectReason();
}
`

Here are some example usages of the new API:

`java
ClientConnectionEvents.LOGIN.register(context -> {
Minecraft minecraft = context.minecraft();

if (context.isServerLocal()) {
String worldName = context.worldName();
} else {
String serverAddress = context.serverAddress();
int serverPort = context.serverPort();
}
});
`

`java
ServerConnectionEvents.DISCONNECT.register(context -> {
TextComponent disconnectReason = context.disconnectReason();
});
`

### Fixes

  • Fixed DISCONNECT events not being fired on the side that initiated the disconnect (e.g. when leaving the server the event was not fired client-side, and when kicking a player the event was not fired server-side).
  • Fixed crash in 1.14 server environments.
  • Fixed crash in 12w18a-12w19a due to invalid mixins.json.

## Resource Loader 0.8.0

### Resource Locations

The
ResourceLocation class now has a factory method for creating a NamespacedIdentifier representing a resource location, that always uses the proper validation for the runtime Minecraft version and supported resource pack format. The validation rules are:
  • Resource pack format 1 and 2 (1.10.2 and below): no uppercase letters ([A-Z]) in namespaces, no validation on paths.
  • Resource pack format 3 (16w32a-17w47a): no uppercase letters ([A-Z]) in namespaces nor in paths.
  • Resource pack format 4 (17w48a and above): only [-.\_a-z0-9] allowed in namespaces and only [-.\_/a-z0-9] allowed in paths.

`java
NamespacedIdentifier resourceLocation = ResourceLocation.of("example", "path/to/resource");

// check if the resource location is valid for the runtime Minecraft version and resource pack format
ResourceLocation.isValid(resourceLocation);
ResourceLocation.isValidNamespace("example");
ResourceLocation.isValidPath("path/to/resource");
`

### Resource Packs

The pack icon for resource packs added through custom repository sources now falls back to the default pack icon if none is provided. In prior OSL versions the pack icon would fall back to the missing texture instead, which did not match Vanilla behavior.

### Fixes

  • ([#76](https://github.com/OrnitheMC/ornithe-standard-libraries/pull/76)) Fixed errors thrown during RESOURCE_RELOAD_END events being silently caught instead of rethrown.
  • Fixed crashes due to improper resource location validation.
  • Fixed resource metadata sometimes not loading in 1.13 and above.
  • Fixed sound freeze issues due to a ZipFileSystem thread interrupt bug.
  • Fixed crash in 12w15a-12w17a due to an invalid mixin.

## Localization 0.1.1

  • Fixes potential NPEs if localization is not set up.
  • Fixes formatting errors in some versions (like command feedback in 1.6) by replacing illegal/unsupported formatting codes.

## Text Components 0.1 Alpha 4

Vanilla
Text components can now be converted to OSL TextComponents through TextComponents.resolve.

`java
TextComponent literalText = TextComponents.resolve(new LiteralText("This is text!"));
TextComponent translatableText = TextComponents.resolve(new TranslatableText("this.is.text"));
``

## Text Components 0.1 Alpha 5

Fixes a start-up crash in 1.6.4 and below due to a missing entrypoint.

# Ornithe Standard Libraries 0.20.3

OSL 0.20.3 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Resource Loader 0.7.4

  • Fixed more texture pack issues.

# Ornithe Standard Libraries 0.20.2

OSL 0.20.2 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Resource Loader 0.7.3

  • Fixed texture pack resetting to default on game start-up.

# Ornithe Standard Libraries 0.20.1

OSL 0.20.1 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Blocks 0.1.1

  • Fixed being unable to place blocks in air in Minecraft 1.1 and below.

## Text Components 0.1 Alpha 3

Now supports Minecraft Alpha 1.0.1_01-1.0.17_04
# 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.

``java
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

`java
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);
}
}
`
`java
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.

`java
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

`java
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);
}
}
`
`java
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.

`java
Set<String> getCategories()

register(
String: name,
int: defaultKeyCode,
String: category
)
// 17w43a+
register(
String: name,
InputConstants.Type: type,
int: defaultKeyCode,
String: category
)

register(KeyBinding)
`

### Usage

`java
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);
}
}
`
`java
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() {
}
}
``
# Ornithe Standard Libraries 0.19.3

OSL 0.19.3 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Resource Loader 0.7.2

Fixes direct path resource access from the default resource pack not working in 1.6-1.12.
# Ornithe Standard Libraries 0.19.2

OSL 0.19.2 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Config 0.6.2

Fixes a crash in b13-b1.7 when joining a multiplayer server, caused by the crash fix from 0.19.0.
# Ornithe Standard Libraries 0.19.1

OSL 0.19.1 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Resource Loader 0.7.1

Fixes a bug where only one mod resource pack would be used for a resource even if other mod resource packs provided that same resource as well.
# Ornithe Standard Libraries 0.19.0

OSL 0.19.0 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Core 0.8.0

  • Added several internal utilities for other OSL APIs to use.
  • Added IOSupplier, a Supplier that throws IOExceptions.
  • Added Unit, a singleton object.

## Branding 0.4.3

Refactored some things to make use of new Core utilities.

## Config 0.6.1

Fixed CLOSE_WORLD event not firing if the world is closed due to a level save conflict. This would lead to crashes upon joining another world.

## Entrypoints 0.6.1

Suppressed a Mixin warning that would appear in logs.

## Lifecycle Events 0.6.1

Fixed server STOP event firing twice on dedicated servers.

## Localization 0.1.0

The Localization API split off from the Resource Loader API. It provides utilities for localizing text, and handles loading in mods' translation files.

### Localizing Text

The L10n class provides utilities for localizing text.

``java
// localizing a translation key
String localizedText = L10n.get("example.translationKey");

// localizing a translation key with formatting arguments
String localizedTextWithArgs = L10n.get("example.translationKey", "Some Arg", 1);

// localizing a translation key with a default value in case no localization exists
String localizedTextOrDefault = L10n.getOrDefault("example.translationKey", "Example Text");

// checking whether a localization for a translation key exists
boolean localizedTextExists = L10n.has("example.translationKey");
`

### Providing Translations

Translation files can be added to your mod's resources and will be loaded automatically. While Minecraft natively only supports
.lang files in versions 18w01a and below, and only .json files in 18w02a and above, the Localization API ensures both .lang and .json files are supported in any Minecraft version.

The Localization API also adds support for all-lowercase translation file names in 1.10.2 and below (e.g.
en_us.lang instead of en_US.lang).

### Localization in Minecraft Alpha and Beta

While Minecraft supports localization in Minecraft Beta, the only supported language is English (US). OSL's Localization API implements support for other languages, but none are provided by default and no GUI screen for switching languages is added.

Minecraft Alpha does not natively support localization at all, but OSL's Localization API implements the necessities for mods to make use of. Do note that OSL will not modify any Vanilla Minecraft text to localize it.

## Resource Loader 0.7.0

This update to the Resource Loader API is a major rewrite. All internals and code APIs have changed, and mods that make use of them will most likely need to be updated. See the [pull request](https://github.com/OrnitheMC/ornithe-standard-libraries/pull/62) for a detailed overview of the changes and update paths for mods that depend on the Resource Loader API.

## Text Components 0.1 Alpha 2

  • Added TextComponents.builder() method for constructing components with a builder pattern.
  • Added visit methods to TextComponent` for reading components with a visitor pattern.
# Ornithe Standard Libraries 0.18.0

OSL 0.18.0 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Core 0.7.1

The Core API now provides a transitive injected interface for Vanilla's Identifier class implementing OSL's NamespacedIdentifier.

## Branding 0.4.2

Fixes the version string used in Alpha 1.2.1_01 and earlier. The format now matches that used in following versions.

## Entrypoints 0.6.0

The init entrypoint is now invoked *before* client-init and -server-init. This change was made in order to match behavior from Fabric Loader's entrypoints.

## Lifecycle Events

Now supports Beta 1.3.

## Executors 0.1.0

This new API provides access to the main game instances as
java.util.concurrent.Executors, and supplies a background executor for running tasks off the main game thread.

The
Minecraft and MinecraftServer classes are made to implement Executor. Any tasks submitted are guaranteed to run on the main game thread. If called from a different thread, the task will be queued to be run at the start of the next tick. Instances can be acquired using the Lifecycle Events API.

`java
MinecraftInstance.get().execute(
// this code is guaranteed to be run on the main client thread!
);
`

The background executor can be acquired through the
net.ornithemc.osl.executors.api.BackgroundExecutor class.

`java
BackgroundExecutor.get().execute(
// this code is guaranteed to be run on a background thread!
);
`

## Networking Implementation 0.1.1

Fixes a crash due to a Mixin injection failure in late 1.7 snapshots.

## Text Components 0.1 Alpha 1

This new API provides an alternative to Vanilla's chat component system. This is an Alpha release of this API and changes are very likely, so use with caution!

Text components can be made using factory methods in the
net.ornithemc.osl.text.api.TextComponents class. Text components can be converted into legacy formatted strings as well.

`java
TextComponent text = TextComponents.literal("this is a text component")
.format(Formatting.BOLD)
.append(" - and this is another one!");

String string = text.buildFormattedString();
``
# Ornithe Standard Libraries 0.17.2

OSL 0.17.2 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Resource Loader 0.6.1

  • Fixes crashes when mod resources are accessed before the game is done initializing.
  • Fixes crashes in findResources if the search directory does not exist.

# Ornithe Standard Libraries 0.17.1

OSL 0.17.1 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## Branding 0.4.1

Fixes crashes in the Snooper screen.

# Ornithe Standard Libraries 0.17.0

OSL 0.17.0 supports Minecraft versions between Alpha 1.0.1_01 and Release 1.14.4.

## OSL is now on Gen2!

From this point forward, all OSL releases will be for Gen2. Information on how to install Gen2 instances can be found on the [Wiki](https://wiki.ornithemc.net/wiki/Installing_Ornithe).

## Core 0.7.0

### Namespaced Identifiers

This update brings namespaced identifiers, an OSL alternative for Vanilla's Identifier, available for all supported Minecraft versions. The base of this API is the NamespacedIdentifier interface. It defines the namespace and identifier components, which are equivalent to Identifiers namespace and path respectively.

The valid chars for namespace components are a-zA-Z0-9-_.. The valid chars for identifier components are a-zA-Z0-9-_./.

Factory methods for NamespacedIdentifiers can be found in the NamespacedIdentifiers class, along with validation methods. The NamespacedIdentifiers.from methods will throw exceptions if the constructed identifier is invalid.

For improved interoperability with Vanilla, Identifier is made to implement NamespacedIdentifier. This means you can pass Identifier objects in places in OSL's APIs where NamespacedIdentifier is expected.

## Entrypoints 0.5.0

### Custom Run Arguments

The API for parsing custom run arguments has been unified across Minecraft versions as well as between the client and server. JOptSimple is now used everywhere.

## Keybinds 0.2.0

Minecraft versions below 1.3 are now supported.

## Lifecycle Events 0.6.0

### Minecraft game instance

Access to the Minecraft game instance is now provided through the MinecraftInstance class. An exception is thrown if the instance is not available (before initialization or after shutddown).

### Minecraft server instance

Access to the MinecraftServer instance is now provided through the MinecraftServerInstance class. An exception is thrown if the instance is not available (before initialization or after shutddown).

## Networking 0.9.0

The Networking API has been overhauled to be more consistent across Minecraft versions.

### Custom payload channels

In previous versions, OSL relied entirely on Vanilla's definitions of custom payload channels. This meant Strings were used before 1.13 and Identifiers were used after 1.13. From this version on, the API uses NamespacedIdentifiers for channels, and OSL will handle the conversion internally.

To create a channel, use the factory methods in ChannelIdentifiers and register it in ChannelRegistry. For example:

``Java
NamespacedIdentifier COOKIE_CHANNEL = ChannelRegistry.register(ChannelIdentifiers.from("example", "cookie"))
`

### Packet serialization

In previous versions, OSL relied on serialization methods provided by Vanilla. This meant
DataInput and DataOutput were used before 1.7, and PacketByteBuf, a wrapper around Netty's ByteBuf, were used after 1.7. From this version on, the API provides its own ByteBuf implementation: PacketBuffer. It contains many of the same convenience methods PacketByteBuf does, but is used for every Minecraft version supported by the Networking API.

### Packet listener context

Packet listeners are no longer given direct access to the game instance, network handler, or player instance. Instead, a context is provided though which these can be accessed. The context is also used to control asynchronous packet handling. For example:

`java
ServerPlayNetworking.register(CookiePayload.CHANNEL, CookiePayload::new, (ctx, payload) -> {
// ensure following code is only executed from the main thread
ctx.ensureOnMainThread();

// access the current server, network handler, and player through the context
MinecraftServer server = ctx.server();
ServerPlayNetworkHandler networkHandler = ctx.networkHandler();
ServerPlayerEntity player = ctx.player();
})
``
# Ornithe Standard Libraries 0.16.3

## Fixes

### Lifecycle Events API

  • Fixes a crash in server versions prior to a0.2.0.

# Ornithe Standard Libraries 0.16.3

## Fixes

### Lifecycle Events API

  • Fixes a crash in server versions prior to a0.2.0.

# Ornithe Standard Libraries 0.16.3

## Fixes

### Lifecycle Events API

  • Fixes a crash in server versions prior to a0.2.0.

# Ornithe Standard Libraries 0.16.2

## Fixes

### Lifecycle Events API

  • Fixes a crash in server versions prior to b1.2.

# Ornithe Standard Libraries 0.16.2

## Fixes

### Lifecycle Events API

  • Fixes a crash in server versions prior to b1.2.

# Ornithe Standard Libraries 0.16.2

## Fixes

### Lifecycle Events API

  • Fixes a crash in server versions prior to b1.2.

# Ornithe Standard Libraries 0.16.1

## Fixes

### Resource Loader API

  • Fixes a bug in 17w43a and above that caused mod resources to be loaded incorrectly or not at all.

# Ornithe Standard Libraries 0.16.1

## Fixes

### Resource Loader API

  • Fixes a bug in 17w43a and above that caused mod resources to be loaded incorrectly or not at all.

# Ornithe Standard Libraries 0.16.1

## Fixes

### Resource Loader API

  • Fixes a bug in 17w43a and above that caused mod resources to be loaded incorrectly or not at all.

# Ornithe Standard Libraries 0.16.0

## Additions

### Core API

  • New convenience methods for getting and setting registry mappings.

# Ornithe Standard Libraries 0.16.0

## Additions

### Core API

  • New convenience methods for getting and setting registry mappings.

# Ornithe Standard Libraries 0.16.0

## Additions

### Core API

  • New convenience methods for getting and setting registry mappings.

# Ornithe Standard Libraries 0.15.3

## Fixes

### Config API

  • Crash in Beta versions due to the World config scope being destroyed upon game startup.

### Resource Loader API

  • Alternate language file formats are not loaded.

Ornithe Standard Libraries Icon
Download Ornithe Standard Libraries
Select game version
Select platform