create Packages
This commit is contained in:
@@ -2,11 +2,14 @@ package com.tikaiz;
|
||||
|
||||
import com.hypixel.hytale.server.core.plugin.JavaPlugin;
|
||||
import com.hypixel.hytale.server.core.plugin.JavaPluginInit;
|
||||
import com.hypixel.hytale.server.core.universe.world.events.AllWorldsLoadedEvent;
|
||||
import com.tikaiz.commands.ExampleCommand;
|
||||
import com.tikaiz.components.EndermanTeleportComponent;
|
||||
import com.tikaiz.singletons.LoggerSingleton;
|
||||
import com.tikaiz.systems.AddDefaultComponentTickSystem;
|
||||
import com.tikaiz.systems.CustomComponentTickSystem;
|
||||
import com.tikaiz.systems.DamageEventSystem;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class HytaleDemo extends JavaPlugin {
|
||||
|
||||
|
||||
@@ -2,30 +2,22 @@ package com.tikaiz.commands;
|
||||
|
||||
import com.hypixel.hytale.component.Ref;
|
||||
import com.hypixel.hytale.component.Store;
|
||||
import com.hypixel.hytale.component.query.Query;
|
||||
import com.hypixel.hytale.math.vector.Vector3d;
|
||||
import com.hypixel.hytale.math.vector.Vector3f;
|
||||
import com.hypixel.hytale.server.core.Message;
|
||||
import com.hypixel.hytale.server.core.command.system.CommandContext;
|
||||
import com.hypixel.hytale.server.core.command.system.arguments.system.DefaultArg;
|
||||
import com.hypixel.hytale.server.core.command.system.arguments.system.OptionalArg;
|
||||
import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
|
||||
import com.hypixel.hytale.server.core.command.system.basecommands.AbstractPlayerCommand;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.DisplayNameComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.teleport.Teleport;
|
||||
import com.hypixel.hytale.server.core.modules.physics.component.PhysicsValues;
|
||||
import com.hypixel.hytale.server.core.universe.PlayerRef;
|
||||
import com.hypixel.hytale.server.core.universe.Universe;
|
||||
import com.hypixel.hytale.server.core.universe.world.World;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import com.tikaiz.LoggerSingleton;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.logging.Level;
|
||||
|
||||
public class ExampleCommand extends AbstractPlayerCommand {
|
||||
|
||||
@@ -33,7 +25,7 @@ public class ExampleCommand extends AbstractPlayerCommand {
|
||||
super("tel", "Super test command!");
|
||||
}
|
||||
|
||||
DefaultArg<List<Double>> arg = this.withListDefaultArg("Pos", "Position", ArgTypes.DOUBLE,new ArrayList<Double>(),"Tell the Player the Position");
|
||||
DefaultArg<List<Double>> arg = this.withListDefaultArg("Pos", "Position", ArgTypes.DOUBLE, new ArrayList<>(),"Tell the Player the Position");
|
||||
|
||||
@Override
|
||||
protected void execute(@Nonnull CommandContext commandContext,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tikaiz;
|
||||
package com.tikaiz.components;
|
||||
|
||||
import com.hypixel.hytale.component.Component;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
@@ -7,8 +7,8 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class EndermanTeleportComponent implements Component<EntityStore> {
|
||||
|
||||
private float tickInterval = 5f;
|
||||
private float elapsedTime = 0f;
|
||||
private final float tickInterval;
|
||||
private float elapsedTime;
|
||||
|
||||
public EndermanTeleportComponent(float tickInterval, float elapsedTime) {
|
||||
this.tickInterval = tickInterval;
|
||||
@@ -40,6 +40,7 @@ public class EndermanTeleportComponent implements Component<EntityStore> {
|
||||
this.elapsedTime = 0f;
|
||||
}
|
||||
|
||||
@SuppressWarnings("MethodDoesntCallSuperMethod")
|
||||
@Nullable
|
||||
@Override
|
||||
public Component<EntityStore> clone() {
|
||||
@@ -1,14 +0,0 @@
|
||||
package com.tikaiz.events;
|
||||
|
||||
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;
|
||||
|
||||
public class ExampleEvent {
|
||||
|
||||
public static void onPlayerReady(PlayerReadyEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
player.sendMessage(Message.raw("Welcome " + player.getDisplayName()));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +1,16 @@
|
||||
package com.tikaiz;
|
||||
package com.tikaiz.helpers;
|
||||
|
||||
import com.hypixel.hytale.component.CommandBuffer;
|
||||
import com.hypixel.hytale.component.Ref;
|
||||
import com.hypixel.hytale.math.vector.Vector3d;
|
||||
import com.hypixel.hytale.math.vector.Vector3f;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.teleport.Teleport;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
|
||||
abstract class TeleportHelper {
|
||||
public abstract class TeleportHelper {
|
||||
|
||||
static void randomTeleport(@NonNullDecl CommandBuffer<EntityStore> commandBuffer, Ref<EntityStore> ref, Vector3d position) {
|
||||
public static void randomTeleport(@NonNullDecl CommandBuffer<EntityStore> commandBuffer, Ref<EntityStore> ref, Vector3d position) {
|
||||
Vector3d addPos = new Vector3d((Math.random() * 20) - 10, 3, (Math.random() * 20) - 10);
|
||||
|
||||
var newPos = position.add(addPos);
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.tikaiz;
|
||||
package com.tikaiz.singletons;
|
||||
|
||||
import com.hypixel.hytale.logger.HytaleLogger;
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package com.tikaiz;
|
||||
package com.tikaiz.systems;
|
||||
|
||||
import com.hypixel.hytale.component.*;
|
||||
import com.hypixel.hytale.component.query.Query;
|
||||
import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.DisplayNameComponent;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import com.tikaiz.components.EndermanTeleportComponent;
|
||||
import com.tikaiz.singletons.LoggerSingleton;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
|
||||
@@ -1,20 +1,15 @@
|
||||
package com.tikaiz;
|
||||
package com.tikaiz.systems;
|
||||
|
||||
import com.hypixel.hytale.component.*;
|
||||
import com.hypixel.hytale.component.query.Query;
|
||||
import com.hypixel.hytale.component.system.tick.EntityTickingSystem;
|
||||
import com.hypixel.hytale.math.vector.Vector3d;
|
||||
import com.hypixel.hytale.math.vector.Vector3f;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.DisplayNameComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.teleport.Teleport;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import com.tikaiz.components.EndermanTeleportComponent;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
|
||||
import java.util.logging.Level;
|
||||
|
||||
import static com.tikaiz.TeleportHelper.randomTeleport;
|
||||
import static com.tikaiz.helpers.TeleportHelper.randomTeleport;
|
||||
|
||||
public class CustomComponentTickSystem extends EntityTickingSystem<EntityStore> {
|
||||
private final ComponentType<EntityStore, EndermanTeleportComponent> customComponentType;
|
||||
@@ -1,23 +1,23 @@
|
||||
package com.tikaiz;
|
||||
package com.tikaiz.systems;
|
||||
|
||||
import com.hypixel.hytale.component.*;
|
||||
import com.hypixel.hytale.component.query.Query;
|
||||
import com.hypixel.hytale.component.system.EntityEventSystem;
|
||||
import com.hypixel.hytale.server.core.modules.entity.EntityModule;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.DisplayNameComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import com.hypixel.hytale.server.core.util.NotificationUtil;
|
||||
import com.tikaiz.components.EndermanTeleportComponent;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
|
||||
import static com.tikaiz.TeleportHelper.randomTeleport;
|
||||
import static com.tikaiz.helpers.TeleportHelper.randomTeleport;
|
||||
|
||||
public class DamageEventSystem extends EntityEventSystem<EntityStore, Damage> {
|
||||
private final ComponentType<EntityStore, EndermanTeleportComponent> endermanTeleportComponentType;
|
||||
|
||||
protected DamageEventSystem(ComponentType<EntityStore, EndermanTeleportComponent> type) {
|
||||
public DamageEventSystem(ComponentType<EntityStore, EndermanTeleportComponent> type) {
|
||||
super(Damage.class);
|
||||
this.endermanTeleportComponentType = type;
|
||||
}
|
||||
@@ -1,26 +1,4 @@
|
||||
package com.tikaiz;
|
||||
|
||||
import com.hypixel.hytale.component.ArchetypeChunk;
|
||||
import com.hypixel.hytale.component.CommandBuffer;
|
||||
import com.hypixel.hytale.component.Ref;
|
||||
import com.hypixel.hytale.component.Store;
|
||||
import com.hypixel.hytale.component.query.Query;
|
||||
import com.hypixel.hytale.component.system.EntityEventSystem;
|
||||
import com.hypixel.hytale.math.vector.Vector3d;
|
||||
import com.hypixel.hytale.math.vector.Vector3f;
|
||||
import com.hypixel.hytale.server.core.entity.UUIDComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.DisplayNameComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.component.TransformComponent;
|
||||
import com.hypixel.hytale.server.core.modules.entity.damage.Damage;
|
||||
import com.hypixel.hytale.server.core.modules.entity.teleport.Teleport;
|
||||
import com.hypixel.hytale.server.core.universe.world.storage.EntityStore;
|
||||
import com.hypixel.hytale.server.core.util.NotificationUtil;
|
||||
import com.hypixel.hytale.server.npc.AllNPCsLoadedEvent;
|
||||
import com.hypixel.hytale.server.spawning.LoadedNPCEvent;
|
||||
import org.checkerframework.checker.nullness.compatqual.NonNullDecl;
|
||||
import org.checkerframework.checker.nullness.compatqual.NullableDecl;
|
||||
|
||||
import java.util.logging.Level;
|
||||
package com.tikaiz.systems;
|
||||
|
||||
//public class EntitySpawnEventSystem extends EntityEventSystem<EntityStore, LoadedNPCEvent> {
|
||||
// protected EntitySpawnEventSystem() {
|
||||
Reference in New Issue
Block a user