<h1>NeoTale</h1> <p>NeoTale is a lightweight, annotation-driven event system for Hytale plugins inspired by NeoForge’s event bus system. It removes manual registration and boilerplate by automatically discovering and wiring your event handlers at runtime.</p> <hr> <h2>Features</h2> <ul> <li>Annotation-based event subscription</li> <li>No manual registration required</li> <li>Automatic class scanning</li> <li>Static method dispatch</li> <li>Minimal, clean API</li> <li>NeoForge-style workflow</li> </ul> <hr> <h2>How It Works</h2> <p>On startup, NeoTale scans your plugin and automatically detects:</p> <ul> <li>Classes annotated with <code>@EventBusSubscriber</code></li> <li><code>public static</code> methods inside those classes annotated with <code>@SubscribeEvent</code></li> </ul> <p>Any method matching this pattern is automatically registered to the event bus and invoked when the corresponding event fires.</p> <hr> <h2>Event Example</h2> <pre><code>@EventBusSubscriber public final class ServerEvents {
@SubscribeEvent public static void onBoot(BootEvent event) { System.out.println("Server booted!"); }
@SubscribeEvent public static void onBreak(BreakBlockEvent event) { System.out.println("Block broken!"); } } </code></pre> <p>That’s it. NeoTale handles discovery and binding automatically.</p> <hr> <h2>Detection Rules</h2> <p>NeoTale will only register methods that meet all of the following:</p> <ul> <li>Declared in a class annotated with <code>@EventBusSubscriber</code></li> <li>Marked <code>public static</code></li> <li>Annotated with <code>@SubscribeEvent</code></li> <li>Accept exactly one parameter (the event type)</li> </ul> <hr> <h2>System Registration</h2> <p>NeoTale can also auto-register ECS systems using the same annotation-first approach. Declare <code>public static</code> methods annotated with <code>@SubscribeSystem</code> inside an <code>@EventBusSubscriber</code> class. NeoTale will invoke these methods during plugin setup and register the returned system into the correct registry.</p> <hr> <h2>System Example</h2> <pre><code>@EventBusSubscriber public final class Systems {
@SubscribeSystem(store = SystemStore.ENTITY) public static ISystem<EntityStore> myEntitySystem() { return new EntityEventSystem<>(BreakBlockEvent.class) { @Override public void handle(int i, @Nonnull ArchetypeChunk<EntityStore> chunk, @Nonnull Store<EntityStore> store, @Nonnull CommandBuffer<EntityStore> buffer, @Nonnull BreakBlockEvent event) { }
@Override public Query<EntityStore> getQuery() { return Query.any(); } }; }
@SubscribeSystem(store = SystemStore.CHUNK) public static ISystem<ChunkStore> myChunkSystem() { return new RefSystem<ChunkStore>() { @Override public Query<ChunkStore> getQuery() { return Query.any(); }
@Override public void onEntityAdded(Ref<ChunkStore> ref, AddReason reason, Store<ChunkStore> store, CommandBuffer<ChunkStore> buffer) { }
@Override public void onEntityRemove(Ref<ChunkStore> ref, RemoveReason reason, Store<ChunkStore> store, CommandBuffer<ChunkStore> buffer) { } }; } } </code></pre> <hr> <h2>Gradle Setup</h2> <p>Add the NeoTale Maven repository:</p> <h3>Gradle (Groovy)</h3> <pre><code>repositories { maven { url 'https://dl.cloudsmith.io/public/lio/neotale/maven/' } }
dependencies { implementation "net.liopyu:neotale:$neoTaleVersion" } </code></pre> <h3>Gradle (Kotlin DSL)</h3> <pre><code>repositories { maven("https://dl.cloudsmith.io/public/lio/neotale/maven/") }
dependencies { implementation("net.liopyu:neotale:$neoTaleVersion") } </code></pre> <p> </p> <hr> <h2>Why NeoTale?</h2> <p>Hytale’s native systems are powerful, but event wiring can be repetitive and confusing. NeoTale streamlines development by providing a simple, familiar approach for developers coming from NeoForge event bus subscription.</p> <hr> <h2>Usage & Distribution</h2> <p>NeoTale is free to use in any project, including public servers, modpacks, and redistributed builds. You are allowed to bundle and redistribute NeoTale as-is wherever you need it.</p> <p>The ARR label only applies to direct ownership of the project’s source/assets; it does <strong>not</strong> restrict normal use or redistribution of the built mod.</p> <hr> <p><a href="https://discord.gg/sPHes7q4Pr" target="_blank" rel="nofollow noopener"><img style="display: block; margin-left: auto; margin-right: auto;" src="https://i.ibb.co/qDNhg49/636e0a6a49cf127bf92de1e2-icon-clyde-blurple-RGB.png" alt="discord" width="64"></a></p>
0 Comments