Compare commits

..

13 Commits

Author SHA1 Message Date
5feb2b851f Proper block type detection & chunk data access
Some checks failed
Verifying Everything Compiles / build (push) Has been cancelled
2026-09-13 02:26:06 +02:00
2b0e178704 Working ECS block event test
Some checks failed
Verifying Everything Compiles / build (push) Has been cancelled
2026-09-13 01:37:07 +02:00
Neil
b7d12fde4d Merge pull request #23 from AzureDoom/azuredoom-plugin
Some checks failed
Verifying Everything Compiles / build (push) Has been cancelled
Fixes for VSCode and Jar Name not updating when building
2026-06-19 23:03:15 +05:30
AzureDoom
887468221e Fix: Changing mod_name not updating build jar. 2026-06-19 13:21:06 -04:00
AzureDoom
0d554ed8f3 Fix: Ignore .vscode 2026-06-19 13:20:38 -04:00
Neil
7ce4389085 feat: Adds branch for Hytale-Tools plugin example (#21) 2026-06-08 23:39:18 +05:30
AzureDoom
6985b56930 Adds missing imports (I blame Neil :P) 2026-06-08 14:06:12 -04:00
AzureDoom
8476b14e4e Merge branch 'HytaleModding:main' into azuredoom-plugin 2026-06-08 14:03:13 -04:00
AzureDoom
b7a10d305b Adds an example github action that confirms the mod is building and working. 2026-06-08 14:02:34 -04:00
AzureDoom
3a5f053940 Revert "Update ExampleEvent for changes needed to work latest version"
This reverts commit 314ff77855.
2026-06-08 09:30:54 -04:00
AzureDoom
f0f2476f06 Add example of config as well 2026-06-08 09:28:46 -04:00
AzureDoom
314ff77855 Update ExampleEvent for changes needed to work latest version 2026-06-08 09:28:32 -04:00
Neil
bb19417b47 chore: update to 0.5.0 2026-06-08 02:44:50 +05:30
16 changed files with 228 additions and 38 deletions

22
.github/workflows/gradle.yml vendored Normal file
View File

@@ -0,0 +1,22 @@
name: Verifying Everything Compiles
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v6
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'temurin'
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v5
- name: Verify build is not broken
run: ./gradlew build

1
.gitignore vendored
View File

@@ -9,3 +9,4 @@ run/
.classpath
.project
.settings/
.vscode

View File

@@ -41,6 +41,11 @@ repositories {
mavenCentral()
}
tasks.named<Jar>("jar") {
archiveBaseName.set(project.property("mod_name").toString())
archiveVersion.set(project.property("version").toString())
}
// Uncomment if you are using IntelliJ.
// idea {
// module {

View File

@@ -29,7 +29,7 @@ manifest_group = HytaleModding
mod_name = Replace Me
# Fully-qualified plugin entry point class.
main_class = dev.hytalemodding.ExamplePlugin
main_class = dev.hytalemodding.RitualPlugin
# Comma-separated author entries. Author names cannot contain spaces.
# Each entry supports: Name, Name|Email, or Name|Email|Url.
@@ -37,7 +37,7 @@ main_class = dev.hytalemodding.ExamplePlugin
mod_author = Your_Name|your.email@example.com|https://your-website.com
# Unique lowercase mod identifier.
mod_id = ExamplePlugin
mod_id = RitualPlugin
# SPDX-style license identifier or Proprietary.
mod_license = MIT
@@ -62,10 +62,10 @@ disabled_by_default = false
patchline = release
# Server version mirrored for tooling compatibility.
server_version = 0.5.3
server_version = 0.6.5
# Server version range written into manifest.json.
manifestServerVersion = >=0.5.3 <0.6.0
manifestServerVersion = >=0.6.5 <0.7.0
# Required manifest dependencies. Format: Group:Name=Version,Other:Mod=*
manifest_dependencies = Hytale:AssetModule=*

Binary file not shown.

View File

@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-9.7.1-bin.zip
networkTimeout=10000
retries=0
retryBackOffMs=500

4
gradlew vendored
View File

@@ -20,7 +20,7 @@
##############################################################################
#
# Gradle start up script for POSIX generated by Gradle.
# gradlew start up script for POSIX generated by Gradle.
#
# Important for running:
#
@@ -29,7 +29,7 @@
# bash, then to run this script, type that shell name before the whole
# command line, like:
#
# ksh Gradle
# ksh gradlew
#
# Busybox and similar reduced shells will NOT work, because this script
# requires all of these POSIX shell features:

4
gradlew.bat vendored
View File

@@ -19,7 +19,7 @@
@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem gradlew startup script for Windows
@rem
@rem ##########################################################################
@@ -72,7 +72,7 @@ echo location of your Java installation. 1>&2
@rem Execute Gradle
@rem Execute gradlew
@rem endlocal doesn't take effect until after the line is parsed and variables are expanded
@rem which allows us to clear the local environment before executing the java command
endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel

View File

@@ -1,22 +0,0 @@
package dev.hytalemodding;
import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import dev.hytalemodding.commands.ExampleCommand;
import dev.hytalemodding.events.ExampleEvent;
import javax.annotation.Nonnull;
public class ExamplePlugin extends JavaPlugin {
public ExamplePlugin(@Nonnull JavaPluginInit init) {
super(init);
}
@Override
protected void setup() {
this.getCommandRegistry().registerCommand(new ExampleCommand("example", "An example command"));
this.getEventRegistry().registerGlobal(PlayerReadyEvent.class, ExampleEvent::onPlayerReady);
}
}

View File

@@ -0,0 +1,54 @@
package dev.hytalemodding;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.server.core.util.Config;
import dev.hytalemodding.events.RitualBreakBlockEvent;
import dev.hytalemodding.events.RitualPlaceBlockEvent;
import dev.hytalemodding.commands.ExampleCommand;
import dev.hytalemodding.config.ExampleConfig;
import dev.hytalemodding.events.ExampleEvent;
import javax.annotation.Nonnull;
public class RitualPlugin extends JavaPlugin {
public static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
private static Config<ExampleConfig> config = null;
public RitualPlugin(@Nonnull JavaPluginInit init) {
super(init);
config = this.withConfig("example_config", ExampleConfig.CODEC);
}
@Override
protected void setup() {
LOGGER.atInfo().log("ritual mod loaded");
config.save();
RitualSpawner ritualSpawner = new RitualSpawner();
this.getEntityStoreRegistry().registerSystem(new RitualPlaceBlockEvent(ritualSpawner));
this.getEntityStoreRegistry().registerSystem(new RitualBreakBlockEvent(ritualSpawner));
// Example
this.getCommandRegistry().registerCommand(new ExampleCommand("example", "An example command"));
if (getConfig().get().isEnabledWelcomeMessage()) {
this.getEventRegistry().registerGlobal(PlayerReadyEvent.class, ExampleEvent::onPlayerReady);
}
}
@Override
protected void start() {
}
@Override
protected void shutdown() {
}
public static Config<ExampleConfig> getConfig() {
return config;
}
}

View File

@@ -0,0 +1,13 @@
package dev.hytalemodding;
import com.hypixel.hytale.server.core.universe.world.World;
import org.joml.Vector3i;
public class RitualSpawner {
public void blockChangeEvent(String itemId, Vector3i targetPosition, World world) {
String blockId = world.getBlockType(targetPosition).getId();
RitualPlugin.LOGGER.atInfo().log(
"a block got placed or removed at the position: %d - %d - %d with the block id: %s and with the item id in hand: %s",
targetPosition.x, targetPosition.y, targetPosition.z, blockId, itemId);
}
}

View File

@@ -0,0 +1,25 @@
package dev.hytalemodding.config;
import com.hypixel.hytale.codec.Codec;
import com.hypixel.hytale.codec.KeyedCodec;
import com.hypixel.hytale.codec.builder.BuilderCodec;
public class ExampleConfig {
public static final BuilderCodec<ExampleConfig> CODEC = BuilderCodec.builder(ExampleConfig.class, ExampleConfig::new)
.append(
new KeyedCodec<>("EnableWelcomeMessage", Codec.BOOLEAN),
(exConfig, aBoolean, extraInfo) -> exConfig.enabledWelcomeMessage = aBoolean,
(exConfig, extraInfo) -> exConfig.enabledWelcomeMessage
)
.add()
.build();
private boolean enabledWelcomeMessage;
private ExampleConfig() {}
public boolean isEnabledWelcomeMessage() {
return enabledWelcomeMessage;
}
}

View File

@@ -1,14 +1,24 @@
package dev.hytalemodding.events;
import com.hypixel.hytale.component.Ref;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.server.core.Message;
import com.hypixel.hytale.server.core.entity.entities.Player;
import com.hypixel.hytale.server.core.event.events.player.PlayerReadyEvent;
import com.hypixel.hytale.server.core.universe.PlayerRef;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
public class ExampleEvent {
public static void onPlayerReady(PlayerReadyEvent event) {
Player player = event.getPlayer();
player.sendMessage(Message.raw("Welcome " + player.getDisplayName()));
Ref<EntityStore> ref = event.getPlayerRef();
if (ref.isValid()) {
Store<EntityStore> store = ref.getStore();
PlayerRef playerRef = store.getComponent(ref, PlayerRef.getComponentType());
if (playerRef != null) {
playerRef.sendMessage(Message.raw("Welcome " + playerRef.getUsername()));
}
}
}
}

View File

@@ -0,0 +1,41 @@
package dev.hytalemodding.events;
import com.hypixel.hytale.component.Archetype;
import com.hypixel.hytale.component.ArchetypeChunk;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.component.query.Query;
import com.hypixel.hytale.component.system.EntityEventSystem;
import com.hypixel.hytale.server.core.event.events.ecs.BreakBlockEvent;
import com.hypixel.hytale.server.core.universe.world.World;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import dev.hytalemodding.RitualSpawner;
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
import org.joml.Vector3i;
public class RitualBreakBlockEvent extends EntityEventSystem<EntityStore, BreakBlockEvent> {
private final RitualSpawner ritualSpawner;
public RitualBreakBlockEvent(RitualSpawner ritualSpawner) {
super(BreakBlockEvent.class);
this.ritualSpawner = ritualSpawner;
}
@Override
public void handle(int index,
@NonNullDecl ArchetypeChunk<EntityStore> archetypeChunk,
@NonNullDecl Store<EntityStore> store,
@NonNullDecl CommandBuffer<EntityStore> commandBuffer,
@NonNullDecl BreakBlockEvent breakBlockEvent) {
String itemHolding = breakBlockEvent.getItemInHand().getItemId();
Vector3i blockPosition = breakBlockEvent.getTargetBlock();
World world = store.getExternalData().getWorld();
ritualSpawner.blockChangeEvent(itemHolding, blockPosition, world);
}
@NullableDecl
@Override
public Query<EntityStore> getQuery() {
return Archetype.empty();
}
}

View File

@@ -0,0 +1,41 @@
package dev.hytalemodding.events;
import com.hypixel.hytale.component.Archetype;
import com.hypixel.hytale.component.ArchetypeChunk;
import com.hypixel.hytale.component.CommandBuffer;
import com.hypixel.hytale.component.Store;
import com.hypixel.hytale.component.query.Query;
import com.hypixel.hytale.server.core.event.events.ecs.PlaceBlockEvent;
import com.hypixel.hytale.server.core.universe.world.World;
import dev.hytalemodding.RitualSpawner;
import com.hypixel.hytale.component.system.EntityEventSystem;
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
import org.joml.Vector3i;
public class RitualPlaceBlockEvent extends EntityEventSystem<EntityStore, PlaceBlockEvent> {
private final RitualSpawner ritualSpawner;
public RitualPlaceBlockEvent(RitualSpawner ritualSpawner) {
super(PlaceBlockEvent.class);
this.ritualSpawner = ritualSpawner;
}
@Override
public void handle(int index,
@NonNullDecl ArchetypeChunk<EntityStore> archetypeChunk,
@NonNullDecl Store<EntityStore> store,
@NonNullDecl CommandBuffer<EntityStore> commandBuffer,
@NonNullDecl PlaceBlockEvent placeBlockEvent) {
String blockId = placeBlockEvent.getItemInHand().getItemId();
Vector3i targetPosition = placeBlockEvent.getTargetBlock();
World world = store.getExternalData().getWorld();
ritualSpawner.blockChangeEvent(blockId, targetPosition, world);
}
@NullableDecl
@Override
public Query<EntityStore> getQuery() {
return Archetype.empty();
}
}

View File

@@ -1,6 +1,6 @@
{
"Group": "HytaleModding",
"Name": "ExamplePlugin",
"Name": "RitualPlugin",
"Version": "0.0.0",
"Description": "Description of your plugin",
"Authors": [
@@ -19,8 +19,8 @@
"OptionalDependencies": {
},
"ServerVersion": ">=0.5.3 <0.6.0",
"Main": "dev.hytalemodding.ExamplePlugin",
"ServerVersion": ">=0.6.5 <0.7.0",
"Main": "dev.hytalemodding.RitualPlugin",
"UpdateChecker": {
"CurseForge": ""
}