Compare commits
13 Commits
77b31717f6
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5feb2b851f | |||
| 2b0e178704 | |||
|
|
b7d12fde4d | ||
|
|
887468221e | ||
|
|
0d554ed8f3 | ||
|
|
7ce4389085 | ||
|
|
6985b56930 | ||
|
|
8476b14e4e | ||
|
|
b7a10d305b | ||
|
|
3a5f053940 | ||
|
|
f0f2476f06 | ||
|
|
314ff77855 | ||
|
|
bb19417b47 |
22
.github/workflows/gradle.yml
vendored
Normal file
22
.github/workflows/gradle.yml
vendored
Normal 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
1
.gitignore
vendored
@@ -9,3 +9,4 @@ run/
|
|||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
.settings/
|
.settings/
|
||||||
|
.vscode
|
||||||
@@ -41,6 +41,11 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tasks.named<Jar>("jar") {
|
||||||
|
archiveBaseName.set(project.property("mod_name").toString())
|
||||||
|
archiveVersion.set(project.property("version").toString())
|
||||||
|
}
|
||||||
|
|
||||||
// Uncomment if you are using IntelliJ.
|
// Uncomment if you are using IntelliJ.
|
||||||
// idea {
|
// idea {
|
||||||
// module {
|
// module {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ manifest_group = HytaleModding
|
|||||||
mod_name = Replace Me
|
mod_name = Replace Me
|
||||||
|
|
||||||
# Fully-qualified plugin entry point class.
|
# 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.
|
# Comma-separated author entries. Author names cannot contain spaces.
|
||||||
# Each entry supports: Name, Name|Email, or Name|Email|Url.
|
# 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
|
mod_author = Your_Name|your.email@example.com|https://your-website.com
|
||||||
|
|
||||||
# Unique lowercase mod identifier.
|
# Unique lowercase mod identifier.
|
||||||
mod_id = ExamplePlugin
|
mod_id = RitualPlugin
|
||||||
|
|
||||||
# SPDX-style license identifier or Proprietary.
|
# SPDX-style license identifier or Proprietary.
|
||||||
mod_license = MIT
|
mod_license = MIT
|
||||||
@@ -62,10 +62,10 @@ disabled_by_default = false
|
|||||||
patchline = release
|
patchline = release
|
||||||
|
|
||||||
# Server version mirrored for tooling compatibility.
|
# Server version mirrored for tooling compatibility.
|
||||||
server_version = 0.5.3
|
server_version = 0.6.5
|
||||||
|
|
||||||
# Server version range written into manifest.json.
|
# 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=*
|
# Required manifest dependencies. Format: Group:Name=Version,Other:Mod=*
|
||||||
manifest_dependencies = Hytale:AssetModule=*
|
manifest_dependencies = Hytale:AssetModule=*
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
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
|
networkTimeout=10000
|
||||||
retries=0
|
retries=0
|
||||||
retryBackOffMs=500
|
retryBackOffMs=500
|
||||||
|
|||||||
4
gradlew
vendored
4
gradlew
vendored
@@ -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:
|
# Important for running:
|
||||||
#
|
#
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
# bash, then to run this script, type that shell name before the whole
|
# bash, then to run this script, type that shell name before the whole
|
||||||
# command line, like:
|
# command line, like:
|
||||||
#
|
#
|
||||||
# ksh Gradle
|
# ksh gradlew
|
||||||
#
|
#
|
||||||
# Busybox and similar reduced shells will NOT work, because this script
|
# Busybox and similar reduced shells will NOT work, because this script
|
||||||
# requires all of these POSIX shell features:
|
# requires all of these POSIX shell features:
|
||||||
|
|||||||
4
gradlew.bat
vendored
4
gradlew.bat
vendored
@@ -19,7 +19,7 @@
|
|||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@rem Gradle startup script for Windows
|
@rem gradlew startup script for Windows
|
||||||
@rem
|
@rem
|
||||||
@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 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
|
@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
|
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
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
54
src/main/java/dev/hytalemodding/RitualPlugin.java
Normal file
54
src/main/java/dev/hytalemodding/RitualPlugin.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/main/java/dev/hytalemodding/RitualSpawner.java
Normal file
13
src/main/java/dev/hytalemodding/RitualSpawner.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
25
src/main/java/dev/hytalemodding/config/ExampleConfig.java
Normal file
25
src/main/java/dev/hytalemodding/config/ExampleConfig.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,24 @@
|
|||||||
package dev.hytalemodding.events;
|
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.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.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 class ExampleEvent {
|
||||||
|
|
||||||
public static void onPlayerReady(PlayerReadyEvent event) {
|
public static void onPlayerReady(PlayerReadyEvent event) {
|
||||||
Player player = event.getPlayer();
|
Ref<EntityStore> ref = event.getPlayerRef();
|
||||||
player.sendMessage(Message.raw("Welcome " + player.getDisplayName()));
|
|
||||||
|
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()));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"Group": "HytaleModding",
|
"Group": "HytaleModding",
|
||||||
"Name": "ExamplePlugin",
|
"Name": "RitualPlugin",
|
||||||
"Version": "0.0.0",
|
"Version": "0.0.0",
|
||||||
"Description": "Description of your plugin",
|
"Description": "Description of your plugin",
|
||||||
"Authors": [
|
"Authors": [
|
||||||
@@ -19,8 +19,8 @@
|
|||||||
"OptionalDependencies": {
|
"OptionalDependencies": {
|
||||||
|
|
||||||
},
|
},
|
||||||
"ServerVersion": ">=0.5.3 <0.6.0",
|
"ServerVersion": ">=0.6.5 <0.7.0",
|
||||||
"Main": "dev.hytalemodding.ExamplePlugin",
|
"Main": "dev.hytalemodding.RitualPlugin",
|
||||||
"UpdateChecker": {
|
"UpdateChecker": {
|
||||||
"CurseForge": ""
|
"CurseForge": ""
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user