mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-02-16 12:21:25 +01:00
Add /npc camel, minor code cleanup
This commit is contained in:
parent
33b6e6eb37
commit
c6e7ce65f5
@ -9,7 +9,7 @@
|
||||
<artifactId>citizens-main</artifactId>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<craftbukkit.version>1.19.2-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
<craftbukkit.version>1.19.3-R0.1-SNAPSHOT</craftbukkit.version>
|
||||
<placeholderapi.version>2.11.2</placeholderapi.version>
|
||||
<citizensapi.version>${project.version}</citizensapi.version>
|
||||
<worldguard.version>7.0.4</worldguard.version>
|
||||
|
@ -0,0 +1,75 @@
|
||||
package net.citizensnpcs.trait.versioned;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Camel;
|
||||
|
||||
import net.citizensnpcs.api.command.Command;
|
||||
import net.citizensnpcs.api.command.CommandContext;
|
||||
import net.citizensnpcs.api.command.CommandMessages;
|
||||
import net.citizensnpcs.api.command.Flag;
|
||||
import net.citizensnpcs.api.command.Requirements;
|
||||
import net.citizensnpcs.api.command.exception.CommandException;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.persistence.Persist;
|
||||
import net.citizensnpcs.api.trait.Trait;
|
||||
import net.citizensnpcs.api.trait.TraitName;
|
||||
import net.citizensnpcs.api.trait.trait.MobType;
|
||||
import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.util.Messages;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
|
||||
@TraitName("cameltrait")
|
||||
public class CamelTrait extends Trait {
|
||||
@Persist
|
||||
private CamelPose pose;
|
||||
|
||||
public CamelTrait() {
|
||||
super("cameltrait");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (npc.isSpawned() && npc.getEntity() instanceof Camel) {
|
||||
Camel camel = (Camel) npc.getEntity();
|
||||
if (pose != null) {
|
||||
NMS.setCamelPose(npc.getEntity(), pose);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setPose(CamelPose pose) {
|
||||
this.pose = pose;
|
||||
}
|
||||
|
||||
public enum CamelPose {
|
||||
PANIC,
|
||||
SITTING,
|
||||
STANDING
|
||||
}
|
||||
|
||||
@Command(
|
||||
aliases = { "npc" },
|
||||
usage = "camel (--pose pose) (--strength strength)",
|
||||
desc = "Sets camel modifiers",
|
||||
modifiers = { "camel" },
|
||||
min = 1,
|
||||
max = 1,
|
||||
permission = "citizens.npc.camel")
|
||||
@Requirements(selected = true, ownership = true)
|
||||
public static void camel(CommandContext args, CommandSender sender, NPC npc, @Flag("pose") CamelPose pose)
|
||||
throws CommandException {
|
||||
if (npc.getOrAddTrait(MobType.class).getType().name().equals("CAMEL"))
|
||||
throw new CommandException(CommandMessages.REQUIREMENTS_INVALID_MOB_TYPE);
|
||||
CamelTrait trait = npc.getOrAddTrait(CamelTrait.class);
|
||||
String output = "";
|
||||
|
||||
if (pose != null) {
|
||||
trait.setPose(pose);
|
||||
output += Messaging.tr(Messages.CAMEL_POSE_SET, pose);
|
||||
}
|
||||
|
||||
if (!output.isEmpty()) {
|
||||
Messaging.send(sender, output);
|
||||
}
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@ public class Messages {
|
||||
public static final String BEHAVIOUR_HELP = "citizens.commands.npc.behaviour.help";
|
||||
public static final String BEHAVIOURS_ADDED = "citizens.commands.npc.behaviour.added";
|
||||
public static final String BEHAVIOURS_REMOVED = "citizens.commands.npc.behaviour.removed";
|
||||
public static final String CAMEL_POSE_SET = "citizens.commands.npc.camel.pose-set";
|
||||
public static final String CANNOT_TELEPORT_ACROSS_WORLDS = "citizens.commands.npc.tphere.multiworld-not-allowed";
|
||||
public static final String CAT_COLLAR_COLOR_SET = "citizens.commands.npc.cat.collar-color-set";
|
||||
public static final String CAT_STARTED_LYING = "citizens.commands.npc.cat.lying-start";
|
||||
|
@ -43,6 +43,7 @@ import net.citizensnpcs.api.util.Messaging;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
|
||||
|
||||
public class NMS {
|
||||
private NMS() {
|
||||
@ -532,6 +533,10 @@ public class NMS {
|
||||
BRIDGE.setBodyYaw(entity, yaw);
|
||||
}
|
||||
|
||||
public static void setCamelPose(Entity entity, CamelPose pose) {
|
||||
BRIDGE.setCamelPose(entity, pose);
|
||||
}
|
||||
|
||||
public static void setCustomName(Entity entity, Object component) {
|
||||
BRIDGE.setCustomName(entity, component);
|
||||
}
|
||||
|
@ -37,6 +37,7 @@ import net.citizensnpcs.api.util.BoundingBox;
|
||||
import net.citizensnpcs.npc.ai.MCNavigationStrategy.MCNavigator;
|
||||
import net.citizensnpcs.npc.ai.MCTargetStrategy.TargetNavigator;
|
||||
import net.citizensnpcs.npc.skin.SkinnableEntity;
|
||||
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
|
||||
|
||||
public interface NMSBridge {
|
||||
public boolean addEntityToWorld(Entity entity, SpawnReason custom);
|
||||
@ -51,7 +52,9 @@ public interface NMSBridge {
|
||||
|
||||
public BlockBreaker getBlockBreaker(Entity entity, Block targetBlock, BlockBreakerConfiguration config);
|
||||
|
||||
public Object getBossBar(Entity entity);
|
||||
public default Object getBossBar(Entity entity) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public BoundingBox getBoundingBox(Entity handle);
|
||||
|
||||
@ -145,10 +148,16 @@ public interface NMSBridge {
|
||||
|
||||
public void sendTeamPacket(Player recipient, Team team, int mode);
|
||||
|
||||
public void setAllayDancing(Entity entity, boolean dancing);
|
||||
public default void setAllayDancing(Entity entity, boolean dancing) {
|
||||
throw new UnsupportedOperationException();
|
||||
};
|
||||
|
||||
public void setBodyYaw(Entity entity, float yaw);
|
||||
|
||||
public default void setCamelPose(Entity entity, CamelPose pose) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void setCustomName(Entity entity, Object component);
|
||||
|
||||
public void setDestination(Entity entity, double x, double y, double z, float speed);
|
||||
@ -159,21 +168,31 @@ public interface NMSBridge {
|
||||
|
||||
public void setKnockbackResistance(LivingEntity entity, double d);
|
||||
|
||||
public void setLyingDown(Entity cat, boolean lying);
|
||||
public default void setLyingDown(Entity cat, boolean lying) {
|
||||
throw new UnsupportedOperationException();
|
||||
};
|
||||
|
||||
public void setNavigationTarget(Entity handle, Entity target, float speed);
|
||||
|
||||
public void setNoGravity(Entity entity, boolean nogravity);
|
||||
|
||||
public void setPandaSitting(Entity entity, boolean sitting);
|
||||
public default void setPandaSitting(Entity entity, boolean sitting) {
|
||||
throw new UnsupportedOperationException();
|
||||
};
|
||||
|
||||
public void setPeekShulker(Entity entity, int peek);
|
||||
public default void setPeekShulker(Entity entity, int peek) {
|
||||
throw new UnsupportedOperationException();
|
||||
};
|
||||
|
||||
public void setPiglinDancing(Entity entity, boolean dancing);
|
||||
public default void setPiglinDancing(Entity entity, boolean dancing) {
|
||||
throw new UnsupportedOperationException();
|
||||
};
|
||||
|
||||
public void setPitch(Entity entity, float pitch);
|
||||
|
||||
public void setPolarBearRearing(Entity entity, boolean rearing);
|
||||
public default void setPolarBearRearing(Entity entity, boolean rearing) {
|
||||
throw new UnsupportedOperationException();
|
||||
};
|
||||
|
||||
public void setProfile(SkullMeta meta, GameProfile profile);
|
||||
|
||||
@ -209,5 +228,5 @@ public interface NMSBridge {
|
||||
|
||||
public void updateNavigationWorld(Entity entity, World world);
|
||||
|
||||
public void updatePathfindingRange(NPC npc, float pathfindingRange);
|
||||
public void updatePathfindingRange(NPC npc, float pathfindingRange);;
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ citizens.commands.npc.cat.sitting-stop=[[{0}]] stopped sitting.
|
||||
citizens.commands.npc.cat.lying-start=[[{0}]] started lying down.
|
||||
citizens.commands.npc.cat.lying-stop=[[{0}]] stopped lying down.
|
||||
citizens.commands.npc.cat.type-set=Type set to [[{0}]].
|
||||
citizens.commands.npc.camel.pose-set=Pose set to [[{0}]].
|
||||
citizens.commands.npc.chunkload.set=[[{0}]] will now force chunks to be loaded.
|
||||
citizens.commands.npc.chunkload.unset=[[{0}]] will no longer force chunks to be loaded.
|
||||
citizens.commands.npc.collidable.set=[[{0}]] will now collide with entities.
|
||||
|
@ -1038,10 +1038,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1089,10 +1085,6 @@ public class NMSImpl implements NMSBridge {
|
||||
handle.getAttributeInstance(GenericAttributes.c).setValue(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLyingDown(org.bukkit.entity.Entity cat, boolean lying) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNavigationTarget(org.bukkit.entity.Entity handle, org.bukkit.entity.Entity target, float speed) {
|
||||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
@ -1103,19 +1095,11 @@ public class NMSImpl implements NMSBridge {
|
||||
getHandle(entity).setNoGravity(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPiglinDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(org.bukkit.entity.Entity entity, float pitch) {
|
||||
getHandle(entity).pitch = pitch;
|
||||
@ -1664,10 +1648,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return ((CraftEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.aP;
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -1746,7 +1726,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1095,10 +1095,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1147,10 +1143,6 @@ public class NMSImpl implements NMSBridge {
|
||||
handle.getAttributeInstance(GenericAttributes.c).setValue(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLyingDown(org.bukkit.entity.Entity cat, boolean lying) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNavigationTarget(org.bukkit.entity.Entity handle, org.bukkit.entity.Entity target, float speed) {
|
||||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
@ -1161,19 +1153,11 @@ public class NMSImpl implements NMSBridge {
|
||||
getHandle(entity).setNoGravity(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPiglinDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(org.bukkit.entity.Entity entity, float pitch) {
|
||||
getHandle(entity).pitch = pitch;
|
||||
@ -1728,10 +1712,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return ((CraftEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.getHeadRotation();
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -1810,7 +1790,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1105,10 +1105,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1157,10 +1153,6 @@ public class NMSImpl implements NMSBridge {
|
||||
handle.getAttributeInstance(GenericAttributes.c).setValue(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLyingDown(org.bukkit.entity.Entity cat, boolean lying) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNavigationTarget(org.bukkit.entity.Entity handle, org.bukkit.entity.Entity target, float speed) {
|
||||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
@ -1171,19 +1163,11 @@ public class NMSImpl implements NMSBridge {
|
||||
getHandle(entity).setNoGravity(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPiglinDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(org.bukkit.entity.Entity entity, float pitch) {
|
||||
getHandle(entity).pitch = pitch;
|
||||
@ -1738,10 +1722,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return ((CraftEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.getHeadRotation();
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -1820,7 +1800,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1141,10 +1141,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1193,10 +1189,6 @@ public class NMSImpl implements NMSBridge {
|
||||
handle.getAttributeInstance(GenericAttributes.c).setValue(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLyingDown(org.bukkit.entity.Entity cat, boolean lying) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNavigationTarget(org.bukkit.entity.Entity handle, org.bukkit.entity.Entity target, float speed) {
|
||||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
@ -1207,19 +1199,11 @@ public class NMSImpl implements NMSBridge {
|
||||
getHandle(entity).setNoGravity(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPiglinDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(org.bukkit.entity.Entity entity, float pitch) {
|
||||
getHandle(entity).pitch = pitch;
|
||||
@ -1829,10 +1813,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return ((CraftEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.getHeadRotation();
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -1937,7 +1917,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1196,10 +1196,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1263,19 +1259,11 @@ public class NMSImpl implements NMSBridge {
|
||||
getHandle(entity).setNoGravity(enabled);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPiglinDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(org.bukkit.entity.Entity entity, float pitch) {
|
||||
getHandle(entity).pitch = pitch;
|
||||
@ -1976,10 +1964,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return ((CraftEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.getHeadRotation();
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -2075,7 +2059,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1208,10 +1208,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1305,10 +1301,6 @@ public class NMSImpl implements NMSBridge {
|
||||
((EntityShulker) getHandle(shulker)).a((byte) peek);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPiglinDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(org.bukkit.entity.Entity entity, float pitch) {
|
||||
getHandle(entity).pitch = pitch;
|
||||
@ -2010,10 +2002,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return (EntityLiving) NMSImpl.getHandle((org.bukkit.entity.Entity) entity);
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.getHeadRotation();
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -2130,7 +2118,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1238,10 +1238,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1972,10 +1968,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return (EntityLiving) NMSImpl.getHandle((org.bukkit.entity.Entity) entity);
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.getHeadRotation();
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -2102,7 +2094,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1234,10 +1234,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).setYRot(yaw);
|
||||
@ -1969,10 +1965,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return (LivingEntity) NMSImpl.getHandle((org.bukkit.entity.Entity) entity);
|
||||
}
|
||||
|
||||
public static float getHeadYaw(LivingEntity handle) {
|
||||
return handle.getYHeadRot();
|
||||
}
|
||||
|
||||
public static PathNavigation getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof Mob ? ((Mob) handle).getNavigation()
|
||||
@ -2096,7 +2088,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -1241,10 +1241,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).setYRot(yaw);
|
||||
@ -1976,10 +1972,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return (LivingEntity) NMSImpl.getHandle((org.bukkit.entity.Entity) entity);
|
||||
}
|
||||
|
||||
public static float getHeadYaw(LivingEntity handle) {
|
||||
return handle.getYHeadRot();
|
||||
}
|
||||
|
||||
public static PathNavigation getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof Mob ? ((Mob) handle).getNavigation()
|
||||
@ -2103,7 +2095,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
@ -222,6 +222,8 @@ import net.citizensnpcs.trait.versioned.AllayTrait;
|
||||
import net.citizensnpcs.trait.versioned.AxolotlTrait;
|
||||
import net.citizensnpcs.trait.versioned.BeeTrait;
|
||||
import net.citizensnpcs.trait.versioned.BossBarTrait;
|
||||
import net.citizensnpcs.trait.versioned.CamelTrait;
|
||||
import net.citizensnpcs.trait.versioned.CamelTrait.CamelPose;
|
||||
import net.citizensnpcs.trait.versioned.CatTrait;
|
||||
import net.citizensnpcs.trait.versioned.FoxTrait;
|
||||
import net.citizensnpcs.trait.versioned.FrogTrait;
|
||||
@ -304,6 +306,7 @@ import net.minecraft.world.entity.animal.Rabbit;
|
||||
import net.minecraft.world.entity.animal.Turtle;
|
||||
import net.minecraft.world.entity.animal.allay.Allay;
|
||||
import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
||||
import net.minecraft.world.entity.animal.camel.Camel;
|
||||
import net.minecraft.world.entity.animal.horse.AbstractHorse;
|
||||
import net.minecraft.world.entity.boss.enderdragon.EnderDragon;
|
||||
import net.minecraft.world.entity.boss.wither.WitherBoss;
|
||||
@ -824,6 +827,7 @@ public class NMSImpl implements NMSBridge {
|
||||
registerTraitWithCommand(manager, AxolotlTrait.class);
|
||||
registerTraitWithCommand(manager, BeeTrait.class);
|
||||
registerTraitWithCommand(manager, BossBarTrait.class);
|
||||
registerTraitWithCommand(manager, CamelTrait.class);
|
||||
registerTraitWithCommand(manager, CatTrait.class);
|
||||
registerTraitWithCommand(manager, FoxTrait.class);
|
||||
registerTraitWithCommand(manager, FrogTrait.class);
|
||||
@ -1292,6 +1296,30 @@ public class NMSImpl implements NMSBridge {
|
||||
getHandle(entity).setYRot(yaw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCamelPose(org.bukkit.entity.Entity entity, CamelPose pose) {
|
||||
if (entity.getType() != EntityType.CAMEL)
|
||||
throw new IllegalStateException();
|
||||
Camel camel = (Camel) getHandle(entity);
|
||||
switch (pose) {
|
||||
case STANDING:
|
||||
if (!camel.isStanding()) {
|
||||
camel.standUp();
|
||||
}
|
||||
return;
|
||||
case SITTING:
|
||||
if (!camel.isPoseSitting()) {
|
||||
camel.sitDown();
|
||||
}
|
||||
return;
|
||||
case PANIC:
|
||||
if (!camel.isPanicking()) {
|
||||
camel.standUpPanic();
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCustomName(org.bukkit.entity.Entity entity, Object component) {
|
||||
getHandle(entity).setCustomName((Component) component);
|
||||
@ -2018,10 +2046,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return (LivingEntity) NMSImpl.getHandle((org.bukkit.entity.Entity) entity);
|
||||
}
|
||||
|
||||
public static float getHeadYaw(LivingEntity handle) {
|
||||
return handle.getYHeadRot();
|
||||
}
|
||||
|
||||
public static PathNavigation getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof Mob ? ((Mob) handle).getNavigation()
|
||||
|
@ -340,11 +340,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return new CitizensBlockBreaker(entity, targetBlock, config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getBossBar(org.bukkit.entity.Entity entity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BoundingBox getBoundingBox(org.bukkit.entity.Entity handle) {
|
||||
AxisAlignedBB bb = NMSImpl.getHandle(handle).getBoundingBox();
|
||||
@ -979,10 +974,6 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAllayDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBodyYaw(org.bukkit.entity.Entity entity, float yaw) {
|
||||
getHandle(entity).yaw = yaw;
|
||||
@ -1028,10 +1019,6 @@ public class NMSImpl implements NMSBridge {
|
||||
handle.getAttributeInstance(GenericAttributes.c).setValue(d);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLyingDown(org.bukkit.entity.Entity cat, boolean lying) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNavigationTarget(org.bukkit.entity.Entity handle, org.bukkit.entity.Entity target, float speed) {
|
||||
NMSImpl.getNavigation(handle).a(NMSImpl.getHandle(target), speed);
|
||||
@ -1046,29 +1033,11 @@ public class NMSImpl implements NMSBridge {
|
||||
entity.setVelocity(vector);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPandaSitting(org.bukkit.entity.Entity entity, boolean sitting) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPeekShulker(org.bukkit.entity.Entity shulker, int peek) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPiglinDancing(org.bukkit.entity.Entity entity, boolean dancing) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPitch(org.bukkit.entity.Entity entity, float pitch) {
|
||||
getHandle(entity).pitch = pitch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPolarBearRearing(org.bukkit.entity.Entity entity, boolean rearing) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProfile(SkullMeta meta, GameProfile profile) {
|
||||
if (SKULL_PROFILE_FIELD == null) {
|
||||
@ -1558,10 +1527,6 @@ public class NMSImpl implements NMSBridge {
|
||||
return ((CraftEntity) entity).getHandle();
|
||||
}
|
||||
|
||||
public static float getHeadYaw(EntityLiving handle) {
|
||||
return handle.aJ;
|
||||
}
|
||||
|
||||
public static NavigationAbstract getNavigation(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = getHandle(entity);
|
||||
return handle instanceof EntityInsentient ? ((EntityInsentient) handle).getNavigation()
|
||||
@ -1626,7 +1591,8 @@ public class NMSImpl implements NMSBridge {
|
||||
radius *= radius;
|
||||
final org.bukkit.World world = location.getWorld();
|
||||
for (Player player : CitizensAPI.getLocationLookup().getNearbyPlayers(location, radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from)) || (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
if (world != player.getWorld() || (from != null && !player.canSee(from))
|
||||
|| (location.distanceSquared(player.getLocation(PACKET_CACHE_LOCATION)) > radius)) {
|
||||
continue;
|
||||
}
|
||||
for (Packet<?> packet : packets) {
|
||||
|
Loading…
Reference in New Issue
Block a user