Added SolarCellInitializer

This commit is contained in:
2026-02-06 18:14:31 +01:00
parent 4cb965adb9
commit 6fc02d82b4
3 changed files with 69 additions and 7 deletions

View File

@@ -1,23 +1,28 @@
package org.KaiFlo.SolarCell;
import com.hypixel.hytale.component.ComponentType;
import com.hypixel.hytale.logger.HytaleLogger;
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
import com.hypixel.hytale.server.core.universe.world.storage.ChunkStore;
import org.KaiFlo.SolarCell.Commands.ExampleCommand;
import org.KaiFlo.SolarCell.Components.EnergySource.Implementations.SolarCellComponent;
import org.KaiFlo.SolarCell.Systems.EnergySource.SolarCellInitializer;
import javax.annotation.Nonnull;
/**
* This class serves as the entrypoint for your plugin. Use the setup method to register into game registries or add
* event listeners.
*/
@SuppressWarnings("unused")
public class SolarCellPlugin extends JavaPlugin {
protected static SolarCellPlugin instance;
public static SolarCellPlugin get() {
return instance;
}
private static final HytaleLogger LOGGER = HytaleLogger.forEnclosingClass();
private ComponentType<ChunkStore, SolarCellComponent> solarCellComponentType;
public SolarCellPlugin(@Nonnull JavaPluginInit init) {
super(init);
LOGGER.atInfo().log("Hello from " + this.getName() + " version " + this.getManifest().getVersion().toString());
@@ -25,8 +30,18 @@ public class SolarCellPlugin extends JavaPlugin {
@Override
protected void setup() {
instance = this;
LOGGER.atInfo().log("Setting up plugin " + this.getName());
solarCellComponentType = this.getChunkStoreRegistry().registerComponent(SolarCellComponent.class, "SolarCell", SolarCellComponent.CODEC);
this.getCommandRegistry().registerCommand(new ExampleCommand(this.getName(), this.getManifest().getVersion().toString()));
this.getChunkStoreRegistry().registerComponent(SolarCellComponent.class,"SolarCell",SolarCellComponent.CODEC);
this.getChunkStoreRegistry().registerSystem(new SolarCellInitializer());
}
public ComponentType<ChunkStore, SolarCellComponent> getSolarCellComponentType() {
return solarCellComponentType;
}
}