mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Make nonliving entities look at entities too, fix /npc lookclose with shulkers spamming noises
This commit is contained in:
parent
626b6d6b42
commit
97d4c3b117
@ -215,8 +215,11 @@ public class LookClose extends Trait implements Toggleable, CommandConfigurable
|
||||
return;
|
||||
Util.faceEntity(npc.getEntity(), lookingAt);
|
||||
if (npc.getEntity().getType().name().equals("SHULKER")) {
|
||||
NMS.setPeekShulker(npc.getEntity(), 100 - (int) Math
|
||||
boolean wasSilent = npc.getEntity().isSilent();
|
||||
npc.getEntity().setSilent(true);
|
||||
NMS.setPeekShulker(npc.getEntity(), 100 - 4 * (int) Math
|
||||
.floor(npc.getStoredLocation().distanceSquared(lookingAt.getLocation(PLAYER_LOCATION))));
|
||||
npc.getEntity().setSilent(wasSilent);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -761,7 +761,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -816,7 +816,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -824,7 +824,8 @@ public class NMSImpl implements NMSBridge {
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
BAD_CONTROLLER_LOOK.add(EntityType.SHULKER);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -859,7 +859,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -927,7 +927,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -939,7 +939,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -959,7 +959,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -963,7 +963,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof Mob) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof org.bukkit.entity.LivingEntity) {
|
||||
look(from, ((org.bukkit.entity.LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -966,7 +966,9 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof Mob) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof org.bukkit.entity.LivingEntity) {
|
||||
look(from, ((org.bukkit.entity.LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
@ -693,7 +693,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void look(org.bukkit.entity.Entity from, org.bukkit.entity.Entity to) {
|
||||
Entity handle = NMSImpl.getHandle(from), target = NMSImpl.getHandle(to);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())) {
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user