All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.juliarn.npclib.api.Npc Maven / Gradle / Ivy

There is a newer version: 3.0.0-beta10
Show newest version
/*
 * This file is part of npc-lib, licensed under the MIT License (MIT).
 *
 * Copyright (c) 2022-2023 Julian M., Pasqual K. and contributors
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 */

package com.github.juliarn.npclib.api;

import com.github.juliarn.npclib.api.flag.NpcFlag;
import com.github.juliarn.npclib.api.flag.NpcFlaggedBuilder;
import com.github.juliarn.npclib.api.flag.NpcFlaggedObject;
import com.github.juliarn.npclib.api.profile.Profile;
import com.github.juliarn.npclib.api.profile.ProfileResolver;
import com.github.juliarn.npclib.api.protocol.NpcSpecificOutboundPacket;
import com.github.juliarn.npclib.api.protocol.enums.EntityAnimation;
import com.github.juliarn.npclib.api.protocol.enums.ItemSlot;
import com.github.juliarn.npclib.api.protocol.meta.EntityMetadataFactory;
import com.github.juliarn.npclib.api.settings.NpcSettings;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.UnmodifiableView;

public interface Npc extends NpcFlaggedObject {

  NpcFlag LOOK_AT_PLAYER = NpcFlag.flag("imitate_player_look", false);
  NpcFlag HIT_WHEN_PLAYER_HITS = NpcFlag.flag("imitate_player_hit", false);
  NpcFlag SNEAK_WHEN_PLAYER_SNEAKS = NpcFlag.flag("imitate_player_sneak", false);

  int entityId();

  @NotNull Profile.Resolved profile();

  @NotNull W world();

  @NotNull Position position();

  @NotNull NpcSettings

settings(); @NotNull Platform platform(); @NotNull NpcTracker npcTracker(); boolean shouldIncludePlayer(@NotNull P player); @UnmodifiableView @NotNull Collection

includedPlayers(); boolean includesPlayer(@NotNull P player); @NotNull Npc addIncludedPlayer(@NotNull P player); @NotNull Npc removeIncludedPlayer(@NotNull P player); @NotNull Npc unlink(); @UnmodifiableView @NotNull Collection

trackedPlayers(); boolean tracksPlayer(@NotNull P player); @NotNull Npc trackPlayer(@NotNull P player); @NotNull Npc forceTrackPlayer(@NotNull P player); @NotNull Npc stopTrackingPlayer(@NotNull P player); @NotNull NpcSpecificOutboundPacket rotate(float yaw, float pitch); @NotNull NpcSpecificOutboundPacket lookAt(@NotNull Position position); @NotNull NpcSpecificOutboundPacket playAnimation(@NotNull EntityAnimation animation); @NotNull NpcSpecificOutboundPacket changeItem(@NotNull ItemSlot slot, @NotNull I item); @NotNull NpcSpecificOutboundPacket changeMetadata( @NotNull EntityMetadataFactory metadata, @NotNull T value); interface Builder extends NpcFlaggedBuilder> { @NotNull Builder entityId(int id); @NotNull Builder position(@NotNull Position position); @NotNull Builder profile(@NotNull Profile.Resolved profile); default @NotNull CompletableFuture> profile(@NotNull Profile profile) { return this.profile(null, profile); } @NotNull CompletableFuture> profile(@Nullable ProfileResolver resolver, @NotNull Profile profile); @NotNull Builder npcSettings(@NotNull Consumer> decorator); @NotNull Npc build(); @NotNull Npc buildAndTrack(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy