mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-25 12:15:53 +01:00
Run autoformatter
This commit is contained in:
parent
998484718f
commit
c046404799
@ -68,9 +68,8 @@ public class ArmorStandController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, ItemStack itemstack, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
if (npc == null)
|
||||
return super.a(entityhuman, vec3d, itemstack, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
@ -67,7 +67,7 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -121,8 +121,9 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new BatNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class BlazeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -118,8 +118,9 @@ public class BlazeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new BlazeNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -143,8 +143,9 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new CaveSpiderNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -175,11 +176,10 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,7 +82,7 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -152,8 +152,9 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ChickenNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -184,11 +185,10 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +86,7 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -95,9 +95,8 @@ public class CowController extends MobEntityController {
|
||||
if (npc == null || !npc.isProtected())
|
||||
return super.a(entityhuman, enumhand, itemstack);
|
||||
if (itemstack != null && itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild
|
||||
&& !this.isBaby()) {
|
||||
&& !this.isBaby())
|
||||
return false;
|
||||
}
|
||||
return super.a(entityhuman, enumhand, itemstack);
|
||||
}
|
||||
|
||||
@ -167,8 +166,9 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new CowNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -199,11 +199,10 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -79,7 +79,7 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -113,8 +113,9 @@ public class CreeperController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -160,8 +161,9 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new CreeperNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -192,11 +194,10 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -70,7 +70,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -99,8 +99,9 @@ public class EnderDragonController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,8 +139,9 @@ public class EnderDragonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new EnderDragonNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -102,8 +102,9 @@ public class EndermanController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -142,8 +143,9 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new EndermanNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -159,9 +161,8 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean k(double d1, double d2, double d3) {
|
||||
if (npc == null) {
|
||||
if (npc == null)
|
||||
return super.k(d1, d2, d3);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -182,11 +183,10 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,7 +73,7 @@ public class EndermiteController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -102,8 +102,9 @@ public class EndermiteController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -142,8 +143,9 @@ public class EndermiteController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new EndermiteNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -167,17 +169,17 @@ public class EndermiteController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,9 +95,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public boolean a(EntityPlayer entityplayer) {
|
||||
if (npc != null && !isTracked) {
|
||||
if (npc != null && !isTracked)
|
||||
return false;
|
||||
}
|
||||
return super.a(entityplayer);
|
||||
}
|
||||
|
||||
@ -137,12 +136,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
boolean damaged = super.damageEntity(damagesource, f);
|
||||
if (damaged && velocityChanged) {
|
||||
velocityChanged = false;
|
||||
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EntityHumanNPC.this.velocityChanged = true;
|
||||
}
|
||||
});
|
||||
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), () -> EntityHumanNPC.this.velocityChanged = true);
|
||||
}
|
||||
return damaged;
|
||||
}
|
||||
@ -151,16 +145,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
public void die(DamageSource damagesource) {
|
||||
// players that die are not normally removed from the world. when the
|
||||
// NPC dies, we are done with the instance and it should be removed.
|
||||
if (dead) {
|
||||
if (dead)
|
||||
return;
|
||||
}
|
||||
super.die(damagesource);
|
||||
Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
world.removeEntity(EntityHumanNPC.this);
|
||||
}
|
||||
}, 15); // give enough time for death and smoke animation
|
||||
Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), () -> world.removeEntity(EntityHumanNPC.this), 15); // give enough time for death and smoke animation
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -228,9 +216,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public boolean inBlock() {
|
||||
if (npc == null || noclip || isSleeping()) {
|
||||
if (npc == null || noclip || isSleeping())
|
||||
return super.inBlock();
|
||||
}
|
||||
return Util.inBlock(getBukkitEntity());
|
||||
}
|
||||
|
||||
@ -318,11 +305,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
@ -399,7 +385,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
ItemStack equipment = getEquipment(slot);
|
||||
ItemStack cache = equipmentCache.get(slot);
|
||||
if (!(cache == null && equipment == null)
|
||||
if (((cache != null) || (equipment != null))
|
||||
&& (cache == null ^ equipment == null || !ItemStack.equals(cache, equipment))) {
|
||||
itemChanged = true;
|
||||
if (cache != null) {
|
||||
|
@ -50,7 +50,7 @@ public class GhastController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -109,8 +109,9 @@ public class GhastController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new GhastNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class GiantController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new GiantNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -129,8 +129,9 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new GuardianNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -162,11 +163,10 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,6 +50,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
private final CitizensNPC npc;
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -86,7 +87,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -164,8 +165,9 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new HorseNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -211,11 +213,10 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static MethodHandle C = NMS.getMethodHandle(EntityHorse.class, "c", true, int.class, boolean.class);
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.server.v1_10_R1.WorldServer;
|
||||
|
||||
public class HumanController extends AbstractEntityController {
|
||||
public HumanController() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,16 +45,13 @@ public class HumanController extends AbstractEntityController {
|
||||
if (skin != null) {
|
||||
skin.apply(handle);
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (getBukkitEntity() == null || !getBukkitEntity().isValid()
|
||||
|| getBukkitEntity() != handle.getBukkitEntity())
|
||||
return;
|
||||
boolean removeFromPlayerList = npc.data().get("removefromplayerlist",
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(), removeFromPlayerList);
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
if (getBukkitEntity() == null || !getBukkitEntity().isValid()
|
||||
|| getBukkitEntity() != handle.getBukkitEntity())
|
||||
return;
|
||||
boolean removeFromPlayerList = npc.data().get("removefromplayerlist",
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(), removeFromPlayerList);
|
||||
}, 20);
|
||||
handle.getBukkitEntity().setSleepingIgnored(true);
|
||||
return handle.getBukkitEntity();
|
||||
|
@ -59,7 +59,7 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class IronGolemController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new IronGolemNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +65,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -94,8 +94,9 @@ public class MagmaCubeController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -141,8 +142,9 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new MagmaCubeNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -173,11 +175,10 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +75,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<Class<?>, Constructor<?>> CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>();
|
||||
private static final Map<Class<?>, Constructor<?>> CONSTRUCTOR_CACHE = new WeakHashMap<>();
|
||||
private static final MethodHandle UUID_FIELD = NMS.getSetter(net.minecraft.server.v1_10_R1.Entity.class,
|
||||
"uniqueID");
|
||||
}
|
@ -71,7 +71,7 @@ public class MushroomCowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -107,8 +107,9 @@ public class MushroomCowController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -147,8 +148,9 @@ public class MushroomCowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new MushroomCowNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -172,17 +174,17 @@ public class MushroomCowController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class OcelotController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -97,8 +97,9 @@ public class OcelotController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -144,8 +145,9 @@ public class OcelotController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new OcelotNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -169,17 +171,17 @@ public class OcelotController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -105,9 +105,8 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean cP() {
|
||||
if (npc == null) {
|
||||
if (npc == null)
|
||||
return super.cP();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -147,8 +146,9 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new PigNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -179,11 +179,10 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class PigZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class PigZombieController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class PigZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new PigZombieNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -153,17 +155,17 @@ public class PigZombieController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class PolarBearController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -113,8 +113,9 @@ public class PolarBearController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new PolarBearNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -139,8 +139,9 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new RabbitNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -179,11 +180,10 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +68,7 @@ public class SheepController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -97,8 +97,9 @@ public class SheepController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -137,8 +138,9 @@ public class SheepController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SheepNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -162,17 +164,17 @@ public class SheepController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,7 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -89,8 +89,9 @@ public class ShulkerController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -129,8 +130,9 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ShulkerNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -162,11 +164,10 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SilverfishController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SilverfishController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SilverfishController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SilverfishNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -153,17 +155,17 @@ public class SilverfishController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SkeletonController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SkeletonNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +65,7 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -142,8 +142,9 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SlimeNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -174,11 +175,10 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SnowmanController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SnowmanNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SpiderController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SpiderNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -153,17 +155,17 @@ public class SpiderController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SquidController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SquidNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -152,11 +154,10 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,7 +74,7 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -161,8 +161,9 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new VillagerNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -193,11 +194,10 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class WitchController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class WitchController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class WitchController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new WitchNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -153,17 +155,17 @@ public class WitchController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class WitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -79,8 +79,9 @@ public class WitherController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,8 +110,9 @@ public class WitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new WitherNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -140,8 +140,9 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new WolfNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -172,11 +173,10 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class ZombieController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ZombieNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,13 +37,13 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker {
|
||||
|
||||
private float getStrength(IBlockData block) {
|
||||
float base = block.getBlock().b(block, null, new BlockPosition(0, 0, 0));
|
||||
return base < 0.0F ? 0.0F : (!isDestroyable(block) ? 1.0F / base / 100.0F : strengthMod(block) / base / 30.0F);
|
||||
return base < 0.0F ? 0.0F : !isDestroyable(block) ? 1.0F / base / 100.0F : strengthMod(block) / base / 30.0F;
|
||||
}
|
||||
|
||||
private boolean isDestroyable(IBlockData block) {
|
||||
if (block.getMaterial().isAlwaysDestroyable()) {
|
||||
if (block.getMaterial().isAlwaysDestroyable())
|
||||
return true;
|
||||
} else {
|
||||
else {
|
||||
ItemStack current = getCurrentItem();
|
||||
return current != null ? current.b(block) : false;
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker {
|
||||
}
|
||||
}
|
||||
if (handle.hasEffect(MobEffects.FASTER_DIG)) {
|
||||
f *= (1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F);
|
||||
f *= 1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F;
|
||||
}
|
||||
if (handle.hasEffect(MobEffects.SLOWER_DIG)) {
|
||||
float f1 = 1.0F;
|
||||
|
@ -391,9 +391,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (Bukkit.isPrimaryThread())
|
||||
throw new IllegalStateException("NMS.fillProfileProperties cannot be invoked from the main thread.");
|
||||
MinecraftSessionService sessionService = ((CraftServer) Bukkit.getServer()).getServer().ay();
|
||||
if (!(sessionService instanceof YggdrasilMinecraftSessionService)) {
|
||||
if (!(sessionService instanceof YggdrasilMinecraftSessionService))
|
||||
return sessionService.fillProfileProperties(profile, requireSecure);
|
||||
}
|
||||
YggdrasilAuthenticationService auth = ((YggdrasilMinecraftSessionService) sessionService)
|
||||
.getAuthenticationService();
|
||||
URL url = HttpAuthenticationService
|
||||
@ -431,9 +430,8 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (bserver == null) {
|
||||
if (bserver == null)
|
||||
return null;
|
||||
}
|
||||
BossBar ret = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SEGMENTED_10);
|
||||
try {
|
||||
CRAFT_BOSSBAR_HANDLE_FIELD.set(ret, bserver);
|
||||
@ -464,9 +462,8 @@ public class NMSImpl implements NMSBridge {
|
||||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.a()) {
|
||||
if (controller == null || !controller.a())
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
@ -477,9 +474,8 @@ public class NMSImpl implements NMSBridge {
|
||||
|
||||
@Override
|
||||
public float getHeadYaw(org.bukkit.entity.Entity entity) {
|
||||
if (!(entity instanceof LivingEntity)) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return entity.getLocation().getYaw();
|
||||
}
|
||||
return getHandle((LivingEntity) entity).aQ;
|
||||
}
|
||||
|
||||
@ -540,7 +536,7 @@ public class NMSImpl implements NMSBridge {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (handle == null || handle.passengers == null)
|
||||
return Lists.newArrayList();
|
||||
return Lists.transform(handle.passengers, input -> input.getBukkitEntity());
|
||||
return Lists.transform(handle.passengers, Entity::getBukkitEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -588,8 +584,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!npc.isSpawned() || !(npc.getEntity() instanceof LivingEntity))
|
||||
return DEFAULT_SPEED;
|
||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) npc.getEntity());
|
||||
if (handle == null)
|
||||
return DEFAULT_SPEED;
|
||||
if (handle == null) {
|
||||
}
|
||||
return DEFAULT_SPEED;
|
||||
// return (float)
|
||||
// handle.getAttributeInstance(GenericAttributes.d).getValue();
|
||||
@ -613,12 +609,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public MCNavigator getTargetNavigator(final org.bukkit.entity.Entity entity, final Location dest,
|
||||
final NavigatorParameters params) {
|
||||
return getTargetNavigator(entity, params, new Function<NavigationAbstract, Boolean>() {
|
||||
@Override
|
||||
public Boolean apply(NavigationAbstract input) {
|
||||
return input.a(dest.getX(), dest.getY(), dest.getZ(), params.speed());
|
||||
}
|
||||
});
|
||||
return getTargetNavigator(entity, params,
|
||||
input -> input.a(dest.getX(), dest.getY(), dest.getZ(), params.speed()));
|
||||
}
|
||||
|
||||
private MCNavigator getTargetNavigator(final org.bukkit.entity.Entity entity, final NavigatorParameters params,
|
||||
@ -696,11 +688,10 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (handle == null) {
|
||||
if (handle == null)
|
||||
return null;
|
||||
}
|
||||
Entity e = handle.getVehicle();
|
||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -832,7 +823,7 @@ public class NMSImpl implements NMSBridge {
|
||||
public void look(org.bukkit.entity.Entity entity, Location to, boolean headOnly, boolean immediate) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (immediate || headOnly || BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
|| !(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC)) {
|
||||
Location fromLocation = entity.getLocation(FROM_LOCATION);
|
||||
double xDiff, yDiff, zDiff;
|
||||
xDiff = to.getX() - fromLocation.getX();
|
||||
@ -842,8 +833,9 @@ public class NMSImpl implements NMSBridge {
|
||||
double distanceY = Math.sqrt(distanceXZ * distanceXZ + yDiff * yDiff);
|
||||
double yaw = Math.toDegrees(Math.acos(xDiff / distanceXZ));
|
||||
double pitch = Math.toDegrees(Math.acos(yDiff / distanceY)) - 90;
|
||||
if (zDiff < 0.0)
|
||||
if (zDiff < 0.0) {
|
||||
yaw += Math.abs(180 - yaw) * 2;
|
||||
}
|
||||
if (handle instanceof EntityEnderDragon) {
|
||||
yaw = Util.getDragonYaw(handle.getBukkitEntity(), xDiff, zDiff);
|
||||
} else {
|
||||
@ -874,7 +866,7 @@ 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);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
|| !(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC)) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
@ -921,8 +913,6 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public CraftInventoryView getBukkitView() {
|
||||
if (this.bukkitEntity != null) {
|
||||
return this.bukkitEntity;
|
||||
} else {
|
||||
try {
|
||||
this.bukkitEntity = new CraftInventoryView(player,
|
||||
new CitizensInventoryAnvil(new Location(player.getWorld(), 0, 0, 0),
|
||||
@ -933,8 +923,8 @@ public class NMSImpl implements NMSBridge {
|
||||
e.printStackTrace();
|
||||
return super.getBukkitView();
|
||||
}
|
||||
return this.bukkitEntity;
|
||||
}
|
||||
return this.bukkitEntity;
|
||||
}
|
||||
};
|
||||
container.windowId = handle.nextContainerCounter();
|
||||
@ -972,12 +962,11 @@ public class NMSImpl implements NMSBridge {
|
||||
boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist",
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
entity.k_();
|
||||
if (!removeFromPlayerList) {
|
||||
if (!removeFromPlayerList)
|
||||
return;
|
||||
}
|
||||
Entity entity1 = entity.bB();
|
||||
if (entity1 != null) {
|
||||
if ((entity1.dead) || (!entity1.w(entity))) {
|
||||
if (entity1.dead || !entity1.w(entity)) {
|
||||
entity.stopRiding();
|
||||
}
|
||||
} else {
|
||||
@ -1010,8 +999,9 @@ public class NMSImpl implements NMSBridge {
|
||||
return;
|
||||
Class<?> search = clazz;
|
||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||
if (!ENTITY_CLASS_TO_INT.containsKey(search))
|
||||
if (!ENTITY_CLASS_TO_INT.containsKey(search)) {
|
||||
continue;
|
||||
}
|
||||
int code = ENTITY_CLASS_TO_INT.get(search);
|
||||
ENTITY_CLASS_TO_INT.put(clazz, code);
|
||||
ENTITY_CLASS_TO_NAME.put(clazz, ENTITY_CLASS_TO_NAME.get(search));
|
||||
@ -1210,8 +1200,9 @@ public class NMSImpl implements NMSBridge {
|
||||
EntityLiving handle = (EntityLiving) getHandle(entity);
|
||||
yaw = Util.clamp(yaw);
|
||||
handle.aP = yaw;
|
||||
if (!(handle instanceof EntityHuman))
|
||||
if (!(handle instanceof EntityHuman)) {
|
||||
handle.aO = yaw;
|
||||
}
|
||||
handle.aQ = yaw;
|
||||
}
|
||||
|
||||
@ -1340,8 +1331,8 @@ public class NMSImpl implements NMSBridge {
|
||||
EntityPlayer from = (EntityPlayer) getHandle(entity);
|
||||
PerPlayerMetadata<Long> meta = CitizensAPI.getLocationLookup().registerMetadata("sleeping", null);
|
||||
if (sleep) {
|
||||
List<Player> nearbyPlayers = Lists.newArrayList(Iterables
|
||||
.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), (p) -> {
|
||||
List<Player> nearbyPlayers = Lists.newArrayList(
|
||||
Iterables.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), p -> {
|
||||
Long time = meta.getMarker(p.getUniqueId(), entity.getUniqueId().toString());
|
||||
if (time == null || Math.abs(System.currentTimeMillis() - time) > 5000)
|
||||
return true;
|
||||
@ -1380,7 +1371,7 @@ public class NMSImpl implements NMSBridge {
|
||||
list.add(new PacketPlayOutEntityTeleport(from));
|
||||
for (Player nearby : nearbyPlayers) {
|
||||
nearby.sendBlockChange(bedLoc, Material.BED_BLOCK, facingByte);
|
||||
list.forEach((packet) -> sendPacket(nearby, packet));
|
||||
list.forEach(packet -> sendPacket(nearby, packet));
|
||||
meta.set(nearby.getUniqueId(), entity.getUniqueId().toString(), System.currentTimeMillis());
|
||||
}
|
||||
} else {
|
||||
@ -1509,9 +1500,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void setPath() {
|
||||
Location location = parameters.entityTargetLocationMapper().apply(target);
|
||||
if (location == null) {
|
||||
if (location == null)
|
||||
throw new IllegalStateException("mapper should not return null");
|
||||
}
|
||||
navigation.a(location.getX(), location.getY(), location.getZ(), parameters.speed());
|
||||
}
|
||||
|
||||
@ -1584,9 +1574,8 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_10_R1.NBTTagCompound tag) {
|
||||
if (tag == null) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
}
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.c()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
@ -1595,25 +1584,25 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_10_R1.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_10_R1.NBTTagInt) {
|
||||
if (base instanceof net.minecraft.server.v1_10_R1.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_10_R1.NBTTagInt) base).e());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagFloat) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_10_R1.NBTTagFloat) base).i());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagDouble) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_10_R1.NBTTagDouble) base).h());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagLong) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_10_R1.NBTTagLong) base).d());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagShort) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_10_R1.NBTTagShort) base).f());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagByte) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_10_R1.NBTTagByte) base).g());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagByteArray) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_10_R1.NBTTagByteArray) base).c());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagIntArray) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_10_R1.NBTTagIntArray) base).d());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagString) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagString)
|
||||
return new StringTag(key, base.toString());
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagList) {
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagList) {
|
||||
List<net.minecraft.server.v1_10_R1.NBTBase> list = (List<net.minecraft.server.v1_10_R1.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
@ -1623,19 +1612,17 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
return null;
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagCompound) {
|
||||
return convertNBT(((net.minecraft.server.v1_10_R1.NBTTagCompound) base));
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagEnd) {
|
||||
} else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_10_R1.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_10_R1.NBTTagEnd)
|
||||
return new EndTag();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
|
||||
if ((entity.ct()) || (entity.bA())) {
|
||||
if ((entity.isInWater())
|
||||
&& ((!(entity instanceof EntityHuman)) || (!((EntityHuman) entity).abilities.isFlying))) {
|
||||
if (entity.ct() || entity.bA()) {
|
||||
if (entity.isInWater()
|
||||
&& (!(entity instanceof EntityHuman) || !((EntityHuman) entity).abilities.isFlying)) {
|
||||
double d1 = entity.locY;
|
||||
float f4 = entity instanceof EntityPolarBear ? 0.98F : 0.8F;
|
||||
float f3 = 0.02F;
|
||||
@ -1658,12 +1645,12 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!entity.isNoGravity()) {
|
||||
entity.motY -= 0.02D;
|
||||
}
|
||||
if ((entity.positionChanged)
|
||||
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ))) {
|
||||
if (entity.positionChanged
|
||||
&& entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ)) {
|
||||
entity.motY = 0.30000001192092896D;
|
||||
}
|
||||
} else if ((entity.ao())
|
||||
&& ((!(entity instanceof EntityHuman)) || (!((EntityHuman) entity).abilities.isFlying))) {
|
||||
} else if (entity.ao()
|
||||
&& (!(entity instanceof EntityHuman) || !((EntityHuman) entity).abilities.isFlying)) {
|
||||
double d1 = entity.locY;
|
||||
entity.a(f, f1, 0.02F);
|
||||
entity.move(entity.motX, entity.motY, entity.motZ);
|
||||
@ -1673,8 +1660,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!entity.isNoGravity()) {
|
||||
entity.motY -= 0.02D;
|
||||
}
|
||||
if ((entity.positionChanged)
|
||||
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ))) {
|
||||
if (entity.positionChanged
|
||||
&& entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ)) {
|
||||
entity.motY = 0.30000001192092896D;
|
||||
}
|
||||
} else if (entity.cG()) {
|
||||
@ -1689,7 +1676,7 @@ public class NMSImpl implements NMSBridge {
|
||||
float f6 = MathHelper.cos(f5);
|
||||
f6 = (float) (f6 * f6 * Math.min(1.0D, d3 / 0.4D));
|
||||
entity.motY += -0.08D + f6 * 0.06D;
|
||||
if ((entity.motY < 0.0D) && (d0 > 0.0D)) {
|
||||
if (entity.motY < 0.0D && d0 > 0.0D) {
|
||||
double d4 = entity.motY * -0.1D * f6;
|
||||
entity.motY += d4;
|
||||
entity.motX += vec3d.x * d4 / d0;
|
||||
@ -1709,7 +1696,7 @@ public class NMSImpl implements NMSBridge {
|
||||
entity.motY *= 0.9800000190734863D;
|
||||
entity.motZ *= 0.9900000095367432D;
|
||||
entity.move(entity.motX, entity.motY, entity.motZ);
|
||||
if ((entity.positionChanged) && (!entity.world.isClientSide)) {
|
||||
if (entity.positionChanged && !entity.world.isClientSide) {
|
||||
double d4 = Math.sqrt(entity.motX * entity.motX + entity.motZ * entity.motZ);
|
||||
double d5 = d2 - d4;
|
||||
float f7 = (float) (d5 * 10.0D - 3.0D);
|
||||
@ -1718,8 +1705,8 @@ public class NMSImpl implements NMSBridge {
|
||||
entity.damageEntity(DamageSource.FLY_INTO_WALL, f7);
|
||||
}
|
||||
}
|
||||
if ((entity.onGround) && (!entity.world.isClientSide) && (entity.getFlag(7))
|
||||
&& (!CraftEventFactory.callToggleGlideEvent(entity, false).isCancelled())) {
|
||||
if (entity.onGround && !entity.world.isClientSide && entity.getFlag(7)
|
||||
&& !CraftEventFactory.callToggleGlideEvent(entity, false).isCancelled()) {
|
||||
entity.setFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@ -1749,13 +1736,13 @@ public class NMSImpl implements NMSBridge {
|
||||
if (entity.motY < -0.15D) {
|
||||
entity.motY = -0.15D;
|
||||
}
|
||||
boolean flag = (entity.isSneaking()) && ((entity instanceof EntityHuman));
|
||||
if ((flag) && (entity.motY < 0.0D)) {
|
||||
boolean flag = entity.isSneaking() && entity instanceof EntityHuman;
|
||||
if (flag && entity.motY < 0.0D) {
|
||||
entity.motY = 0.0D;
|
||||
}
|
||||
}
|
||||
entity.move(entity.motX, entity.motY, entity.motZ);
|
||||
if ((entity.positionChanged) && (entity.m_())) {
|
||||
if (entity.positionChanged && entity.m_()) {
|
||||
entity.motY = 0.2D;
|
||||
}
|
||||
if (entity.hasEffect(MobEffects.LEVITATION)) {
|
||||
@ -1763,8 +1750,8 @@ public class NMSImpl implements NMSBridge {
|
||||
* 0.2D;
|
||||
} else {
|
||||
blockposition_pooledblockposition.e(entity.locX, 0.0D, entity.locZ);
|
||||
if ((entity.world.isClientSide) && ((!entity.world.isLoaded(blockposition_pooledblockposition))
|
||||
|| (!entity.world.getChunkAtWorldCoords(blockposition_pooledblockposition).p()))) {
|
||||
if (entity.world.isClientSide && (!entity.world.isLoaded(blockposition_pooledblockposition)
|
||||
|| !entity.world.getChunkAtWorldCoords(blockposition_pooledblockposition).p())) {
|
||||
if (entity.locY > 0.0D) {
|
||||
entity.motY = -0.1D;
|
||||
} else {
|
||||
@ -1874,7 +1861,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
public static void sendPacketNearby(Player from, Location location, Packet<?> packet, double radius) {
|
||||
List<Packet<?>> list = new ArrayList<Packet<?>>();
|
||||
List<Packet<?>> list = new ArrayList<>();
|
||||
list.add(packet);
|
||||
sendPacketsNearby(from, location, list, radius);
|
||||
}
|
||||
@ -1883,8 +1870,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) {
|
||||
@ -1906,15 +1893,16 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
|
||||
if ((f != entity.width) || (f1 != entity.length)) {
|
||||
if (f != entity.width || f1 != entity.length) {
|
||||
float f2 = entity.width;
|
||||
entity.width = f;
|
||||
entity.length = f1;
|
||||
entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c,
|
||||
entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length,
|
||||
entity.getBoundingBox().c + entity.width));
|
||||
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
|
||||
if (entity.width > f2 && !justCreated && !entity.world.isClientSide) {
|
||||
entity.move((f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,9 @@ public class PlayerControllerMove extends ControllerMove {
|
||||
f3 = -f2;
|
||||
}
|
||||
float f4 = f + f3;
|
||||
if (f4 < 0.0F)
|
||||
if (f4 < 0.0F) {
|
||||
f4 += 360.0F;
|
||||
else if (f4 > 360.0F) {
|
||||
} else if (f4 > 360.0F) {
|
||||
f4 -= 360.0F;
|
||||
}
|
||||
return f4;
|
||||
@ -90,7 +90,7 @@ public class PlayerControllerMove extends ControllerMove {
|
||||
this.h = new Random().nextInt(20) + 10;
|
||||
this.h /= 3;
|
||||
((EntityInsentient) this.a).getControllerJump().a();
|
||||
} else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && (d0 * d0 + d1 * d1) < 1.0D) {
|
||||
} else if (d2 >= NMS.getStepHeight(a.getBukkitEntity()) && d0 * d0 + d1 * d1 < 1.0D) {
|
||||
if (this.a instanceof EntityHumanNPC) {
|
||||
((EntityHumanNPC) this.a).getControllerJump().a();
|
||||
} else {
|
||||
|
@ -61,23 +61,21 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
BlockPosition localBlockPosition;
|
||||
if (this.b.getType(paramBlockPosition).getMaterial() == Material.AIR) {
|
||||
localBlockPosition = paramBlockPosition.down();
|
||||
while ((localBlockPosition.getY() > 0)
|
||||
&& (this.b.getType(localBlockPosition).getMaterial() == Material.AIR)) {
|
||||
while (localBlockPosition.getY() > 0 && this.b.getType(localBlockPosition).getMaterial() == Material.AIR) {
|
||||
localBlockPosition = localBlockPosition.down();
|
||||
}
|
||||
if (localBlockPosition.getY() > 0) {
|
||||
if (localBlockPosition.getY() > 0)
|
||||
return supera(localBlockPosition.up());
|
||||
}
|
||||
while ((localBlockPosition.getY() < this.b.getHeight())
|
||||
&& (this.b.getType(localBlockPosition).getMaterial() == Material.AIR)) {
|
||||
while (localBlockPosition.getY() < this.b.getHeight()
|
||||
&& this.b.getType(localBlockPosition).getMaterial() == Material.AIR) {
|
||||
localBlockPosition = localBlockPosition.up();
|
||||
}
|
||||
paramBlockPosition = localBlockPosition;
|
||||
}
|
||||
if (this.b.getType(paramBlockPosition).getMaterial().isBuildable()) {
|
||||
localBlockPosition = paramBlockPosition.up();
|
||||
while ((localBlockPosition.getY() < this.b.getHeight())
|
||||
&& (this.b.getType(localBlockPosition).getMaterial().isBuildable())) {
|
||||
while (localBlockPosition.getY() < this.b.getHeight()
|
||||
&& this.b.getType(localBlockPosition).getMaterial().isBuildable()) {
|
||||
localBlockPosition = localBlockPosition.up();
|
||||
}
|
||||
return a2(localBlockPosition);
|
||||
@ -110,9 +108,8 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
@Override
|
||||
public boolean a(Entity paramEntity, double paramDouble) {
|
||||
PathEntity localPathEntity = a(paramEntity);
|
||||
if (localPathEntity != null) {
|
||||
if (localPathEntity != null)
|
||||
return a(localPathEntity, paramDouble);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -120,9 +117,8 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
Vec3D paramVec3D, double paramDouble1, double paramDouble2) {
|
||||
int i = paramInt1 - paramInt4 / 2;
|
||||
int j = paramInt3 - paramInt6 / 2;
|
||||
if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2)) {
|
||||
if (!b(i, paramInt2, j, paramInt4, paramInt5, paramInt6, paramVec3D, paramDouble1, paramDouble2))
|
||||
return false;
|
||||
}
|
||||
for (int k = i; k < i + paramInt4; k++) {
|
||||
for (int m = j; m < j + paramInt6; m++) {
|
||||
double d1 = k + 0.5D - paramVec3D.x;
|
||||
@ -130,20 +126,17 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
|
||||
PathType localPathType = this.e.a(this.b, k, paramInt2 - 1, m, this.a, paramInt4, paramInt5,
|
||||
paramInt6, true, true);
|
||||
if ((localPathType == PathType.WATER) || (localPathType == PathType.LAVA)
|
||||
|| (localPathType == PathType.OPEN)) {
|
||||
if (localPathType == PathType.WATER || localPathType == PathType.LAVA
|
||||
|| localPathType == PathType.OPEN)
|
||||
return false;
|
||||
}
|
||||
localPathType = this.e.a(this.b, k, paramInt2, m, this.a, paramInt4, paramInt5, paramInt6, true,
|
||||
true);
|
||||
float f1 = this.a.a(localPathType);
|
||||
if ((f1 < 0.0F) || (f1 >= 8.0F)) {
|
||||
if (f1 < 0.0F || f1 >= 8.0F)
|
||||
return false;
|
||||
}
|
||||
if ((localPathType == PathType.DAMAGE_FIRE) || (localPathType == PathType.DANGER_FIRE)
|
||||
|| (localPathType == PathType.DAMAGE_OTHER)) {
|
||||
if (localPathType == PathType.DAMAGE_FIRE || localPathType == PathType.DANGER_FIRE
|
||||
|| localPathType == PathType.DAMAGE_OTHER)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -160,9 +153,8 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
this.c = paramPathEntity;
|
||||
}
|
||||
d();
|
||||
if (this.c.d() == 0) {
|
||||
if (this.c.d() == 0)
|
||||
return false;
|
||||
}
|
||||
this.d = paramDouble;
|
||||
Vec3D localVec3D = c();
|
||||
this.i = this.h;
|
||||
@ -179,16 +171,16 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
this.i = this.h;
|
||||
this.j = paramVec3D;
|
||||
}
|
||||
if ((this.c != null) && (!this.c.b())) {
|
||||
if (this.c != null && !this.c.b()) {
|
||||
Vec3D localVec3D = this.c.f();
|
||||
if (!localVec3D.equals(this.k)) {
|
||||
this.k = localVec3D;
|
||||
double d1 = paramVec3D.f(this.k);
|
||||
this.n = (this.a.cp() > 0.0F ? d1 / this.a.cp() * 1000.0D : 0.0D);
|
||||
this.n = this.a.cp() > 0.0F ? d1 / this.a.cp() * 1000.0D : 0.0D;
|
||||
} else {
|
||||
this.l += System.currentTimeMillis() - this.m;
|
||||
}
|
||||
if ((this.n > 0.0D) && (this.l > this.n * 3.0D)) {
|
||||
if (this.n > 0.0D && this.l > this.n * 3.0D) {
|
||||
this.k = Vec3D.a;
|
||||
this.l = 0L;
|
||||
this.n = 0.0D;
|
||||
@ -205,17 +197,15 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
double d1 = paramVec3D2.x - paramVec3D1.x;
|
||||
double d2 = paramVec3D2.z - paramVec3D1.z;
|
||||
double d3 = d1 * d1 + d2 * d2;
|
||||
if (d3 < 1.0E-8D) {
|
||||
if (d3 < 1.0E-8D)
|
||||
return false;
|
||||
}
|
||||
double d4 = 1.0D / Math.sqrt(d3);
|
||||
d1 *= d4;
|
||||
d2 *= d4;
|
||||
paramInt1 += 2;
|
||||
paramInt3 += 2;
|
||||
if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
|
||||
if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2))
|
||||
return false;
|
||||
}
|
||||
paramInt1 -= 2;
|
||||
paramInt3 -= 2;
|
||||
double d5 = 1.0D / Math.abs(d1);
|
||||
@ -236,7 +226,7 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
int i1 = MathHelper.floor(paramVec3D2.z);
|
||||
int i2 = n - i;
|
||||
int i3 = i1 - j;
|
||||
while ((i2 * k > 0) || (i3 * m > 0)) {
|
||||
while (i2 * k > 0 || i3 * m > 0) {
|
||||
if (d7 < d8) {
|
||||
d7 += d5;
|
||||
i += k;
|
||||
@ -246,20 +236,17 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
j += m;
|
||||
i3 = i1 - j;
|
||||
}
|
||||
if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2)) {
|
||||
if (!a(i, (int) paramVec3D1.y, j, paramInt1, paramInt2, paramInt3, paramVec3D1, d1, d2))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public PathEntity a2(BlockPosition paramBlockPosition) {
|
||||
if (!b()) {
|
||||
if (!b())
|
||||
return null;
|
||||
}
|
||||
if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.r))) {
|
||||
if (this.c != null && !this.c.b() && paramBlockPosition.equals(this.r))
|
||||
return this.c;
|
||||
}
|
||||
this.r = paramBlockPosition;
|
||||
float f1 = h();
|
||||
this.b.methodProfiler.a("pathfind");
|
||||
@ -274,7 +261,7 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
|
||||
@Override
|
||||
protected boolean b() {
|
||||
return (this.a.onGround) || ((g()) && (p())) || (this.a.isPassenger());
|
||||
return this.a.onGround || g() && p() || this.a.isPassenger();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -294,9 +281,8 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
double d2 = localBlockPosition.getZ() + 0.5D - paramVec3D.z;
|
||||
if (d1 * paramDouble1 + d2 * paramDouble2 >= 0.0D) {
|
||||
Block localBlock = this.b.getType(localBlockPosition).getBlock();
|
||||
if (!localBlock.b(this.b, localBlockPosition)) {
|
||||
if (!localBlock.b(this.b, localBlockPosition))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
@ -323,7 +309,7 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
Block localBlock = localIBlockData.getBlock();
|
||||
if (localBlock == Blocks.cauldron) {
|
||||
this.c.a(i, localPathPoint.a(localPathPoint.a, localPathPoint.b + 1, localPathPoint.c));
|
||||
if ((localObject != null) && (localPathPoint.b >= ((PathPoint) localObject).b)) {
|
||||
if (localObject != null && localPathPoint.b >= ((PathPoint) localObject).b) {
|
||||
this.c.a(i + 1, ((PathPoint) localObject).a(((PathPoint) localObject).a, localPathPoint.b + 1,
|
||||
((PathPoint) localObject).c));
|
||||
}
|
||||
@ -331,9 +317,8 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
}
|
||||
if (this.f2) {
|
||||
if (this.b.h(new BlockPosition(MathHelper.floor(this.a.locX), (int) (this.a.getBoundingBox().b + 0.5D),
|
||||
MathHelper.floor(this.a.locZ)))) {
|
||||
MathHelper.floor(this.a.locZ))))
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < this.c.d(); i++) {
|
||||
localPathPoint = this.c.a(i);
|
||||
if (this.b.h(new BlockPosition(localPathPoint.a, localPathPoint.b, localPathPoint.c))) {
|
||||
@ -387,27 +372,24 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
if (this.p) {
|
||||
j();
|
||||
}
|
||||
if (n()) {
|
||||
if (n())
|
||||
return;
|
||||
}
|
||||
if (b()) {
|
||||
m();
|
||||
} else if ((this.c != null) && (this.c.e() < this.c.d())) {
|
||||
} else if (this.c != null && this.c.e() < this.c.d()) {
|
||||
Vec3D localVec3D = c();
|
||||
Vec3D localObject = this.c.a(this.a, this.c.e());
|
||||
if ((localVec3D.y > localObject.y) && (!this.a.onGround)
|
||||
&& (MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x))
|
||||
&& (MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z))) {
|
||||
if (localVec3D.y > localObject.y && !this.a.onGround
|
||||
&& MathHelper.floor(localVec3D.x) == MathHelper.floor(localObject.x)
|
||||
&& MathHelper.floor(localVec3D.z) == MathHelper.floor(localObject.z)) {
|
||||
this.c.c(this.c.e() + 1);
|
||||
}
|
||||
}
|
||||
if (n()) {
|
||||
if (n())
|
||||
return;
|
||||
}
|
||||
Vec3D localVec3D = this.c.a(this.a);
|
||||
if (localVec3D == null) {
|
||||
if (localVec3D == null)
|
||||
return;
|
||||
}
|
||||
Object localObject = new BlockPosition(localVec3D).down();
|
||||
AxisAlignedBB localAxisAlignedBB = this.b.getType((BlockPosition) localObject).c(this.b,
|
||||
(BlockPosition) localObject);
|
||||
@ -425,10 +407,10 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.o = (this.a.width > 0.75F ? this.a.width / 2.0F : 0.75F - this.a.width / 2.0F);
|
||||
this.o = this.a.width > 0.75F ? this.a.width / 2.0F : 0.75F - this.a.width / 2.0F;
|
||||
Vec3D localVec3D2 = this.c.f();
|
||||
if ((MathHelper.e((float) (this.a.locX - (localVec3D2.x + 0.5D))) < this.o)
|
||||
&& (MathHelper.e((float) (this.a.locZ - (localVec3D2.z + 0.5D))) < this.o)) {
|
||||
if (MathHelper.e((float) (this.a.locX - (localVec3D2.x + 0.5D))) < this.o
|
||||
&& MathHelper.e((float) (this.a.locZ - (localVec3D2.z + 0.5D))) < this.o) {
|
||||
this.c.c(this.c.e() + 1);
|
||||
}
|
||||
int i3 = MathHelper.f(this.a.width);
|
||||
@ -445,7 +427,7 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
|
||||
@Override
|
||||
public boolean n() {
|
||||
return (this.c == null) || (this.c.b());
|
||||
return this.c == null || this.c.b();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -455,26 +437,24 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
|
||||
@Override
|
||||
protected boolean p() {
|
||||
return (this.a.isInWater()) || (this.a.ao());
|
||||
return this.a.isInWater() || this.a.ao();
|
||||
}
|
||||
|
||||
private int r() {
|
||||
if ((!this.a.isInWater()) || (!g())) {
|
||||
if (!this.a.isInWater() || !g())
|
||||
return (int) (this.a.getBoundingBox().b + 0.5D);
|
||||
}
|
||||
int i = (int) this.a.getBoundingBox().b;
|
||||
Block localBlock = this.b
|
||||
.getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ))).getBlock();
|
||||
int j = 0;
|
||||
while ((localBlock == Blocks.FLOWING_WATER) || (localBlock == Blocks.WATER)) {
|
||||
while (localBlock == Blocks.FLOWING_WATER || localBlock == Blocks.WATER) {
|
||||
i++;
|
||||
localBlock = this.b
|
||||
.getType(new BlockPosition(MathHelper.floor(this.a.locX), i, MathHelper.floor(this.a.locZ)))
|
||||
.getBlock();
|
||||
j++;
|
||||
if (j > 16) {
|
||||
if (j > 16)
|
||||
return (int) this.a.getBoundingBox().b;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
@ -484,12 +464,10 @@ public class PlayerNavigation extends NavigationAbstract {
|
||||
}
|
||||
|
||||
public PathEntity supera(BlockPosition paramBlockPosition) {
|
||||
if (!b()) {
|
||||
if (!b())
|
||||
return null;
|
||||
}
|
||||
if ((this.c != null) && (!this.c.b()) && (paramBlockPosition.equals(this.r))) {
|
||||
if (this.c != null && !this.c.b() && paramBlockPosition.equals(this.r))
|
||||
return this.c;
|
||||
}
|
||||
this.r = paramBlockPosition;
|
||||
float f1 = h();
|
||||
BlockPosition localBlockPosition = new BlockPosition(this.a);
|
||||
|
@ -13,7 +13,7 @@ import net.minecraft.server.v1_10_R1.PathPoint;
|
||||
|
||||
public class PlayerPathfinder {
|
||||
private final Path a = new Path();
|
||||
private final Set<PathPoint> b = new HashSet<PathPoint>();
|
||||
private final Set<PathPoint> b = new HashSet<>();
|
||||
private final PathPoint[] c = new PathPoint[32];
|
||||
private final PlayerPathfinderNormal d;
|
||||
|
||||
@ -53,10 +53,10 @@ public class PlayerPathfinder {
|
||||
}
|
||||
PathPoint[] arrayOfPathPoint = new PathPoint[i];
|
||||
localPathPoint = paramPathPoint2;
|
||||
arrayOfPathPoint[(--i)] = localPathPoint;
|
||||
arrayOfPathPoint[--i] = localPathPoint;
|
||||
while (localPathPoint.h != null) {
|
||||
localPathPoint = localPathPoint.h;
|
||||
arrayOfPathPoint[(--i)] = localPathPoint;
|
||||
arrayOfPathPoint[--i] = localPathPoint;
|
||||
}
|
||||
return new PathEntity(arrayOfPathPoint);
|
||||
}
|
||||
@ -88,25 +88,24 @@ public class PlayerPathfinder {
|
||||
for (int k = 0; k < j; k++) {
|
||||
PathPoint localPathPoint = this.c[k];
|
||||
float f1 = localObject2.c(localPathPoint);
|
||||
localPathPoint.j = (localObject2.j + f1);
|
||||
localPathPoint.k = (f1 + localPathPoint.l);
|
||||
localPathPoint.j = localObject2.j + f1;
|
||||
localPathPoint.k = f1 + localPathPoint.l;
|
||||
float f2 = localObject2.e + localPathPoint.k;
|
||||
if ((localPathPoint.j < paramFloat) && ((!localPathPoint.a()) || (f2 < localPathPoint.e))) {
|
||||
localPathPoint.h = (localObject2);
|
||||
if (localPathPoint.j < paramFloat && (!localPathPoint.a() || f2 < localPathPoint.e)) {
|
||||
localPathPoint.h = localObject2;
|
||||
localPathPoint.e = f2;
|
||||
localPathPoint.f = (localPathPoint.c(paramPathPoint2) + localPathPoint.l);
|
||||
localPathPoint.f = localPathPoint.c(paramPathPoint2) + localPathPoint.l;
|
||||
if (localPathPoint.a()) {
|
||||
this.a.a(localPathPoint, localPathPoint.e + localPathPoint.f);
|
||||
} else {
|
||||
localPathPoint.g = (localPathPoint.e + localPathPoint.f);
|
||||
localPathPoint.g = localPathPoint.e + localPathPoint.f;
|
||||
this.a.a(localPathPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localObject1 == paramPathPoint1) {
|
||||
if (localObject1 == paramPathPoint1)
|
||||
return null;
|
||||
}
|
||||
Object localObject2 = a(paramPathPoint1, (PathPoint) localObject1);
|
||||
return (PathEntity) localObject2;
|
||||
}
|
||||
|
@ -56,19 +56,19 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
@Override
|
||||
public PathType a(IBlockAccess paramIBlockAccess, int paramInt1, int paramInt2, int paramInt3) {
|
||||
PathType localPathType1 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
|
||||
if ((localPathType1 == PathType.OPEN) && (paramInt2 >= 1)) {
|
||||
if (localPathType1 == PathType.OPEN && paramInt2 >= 1) {
|
||||
PathType localPathType2 = localPathType1;
|
||||
while (localPathType2 == PathType.OPEN && (--paramInt2 >= 1)) {
|
||||
while (localPathType2 == PathType.OPEN && --paramInt2 >= 1) {
|
||||
localPathType2 = getPathTypeBase(paramIBlockAccess, paramInt1, paramInt2, paramInt3);
|
||||
}
|
||||
localPathType1 = (localPathType2 == PathType.WALKABLE) || (localPathType2 == PathType.OPEN)
|
||||
|| (localPathType2 == PathType.WATER) || (localPathType2 == PathType.LAVA) ? PathType.OPEN
|
||||
localPathType1 = localPathType2 == PathType.WALKABLE || localPathType2 == PathType.OPEN
|
||||
|| localPathType2 == PathType.WATER || localPathType2 == PathType.LAVA ? PathType.OPEN
|
||||
: PathType.WALKABLE;
|
||||
}
|
||||
if (localPathType1 == PathType.WALKABLE) {
|
||||
for (int i = paramInt1 - 1; i <= paramInt1 + 1; i++) {
|
||||
for (int k = paramInt3 - 1; k <= paramInt3 + 1; k++) {
|
||||
if ((i != paramInt1) || (k != paramInt3)) {
|
||||
if (i != paramInt1 || k != paramInt3) {
|
||||
Block localBlock2 = paramIBlockAccess.getType(new BlockPosition(i, paramInt2, k)).getBlock();
|
||||
if (localBlock2 == Blocks.CACTUS) {
|
||||
localPathType1 = PathType.DANGER_CACTUS;
|
||||
@ -94,23 +94,23 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
for (int k = paramInt2; k < paramInt2 + paramInt5; k++) {
|
||||
for (int m = paramInt3; m < paramInt3 + paramInt6; m++) {
|
||||
PathType localPathType2 = a(paramIBlockAccess, i, k, m);
|
||||
if ((localPathType2 == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
|
||||
if (localPathType2 == PathType.DOOR_WOOD_CLOSED && paramBoolean1 && paramBoolean2) {
|
||||
localPathType2 = PathType.WALKABLE;
|
||||
}
|
||||
if ((localPathType2 == PathType.DOOR_OPEN) && (!paramBoolean2)) {
|
||||
if (localPathType2 == PathType.DOOR_OPEN && !paramBoolean2) {
|
||||
localPathType2 = PathType.BLOCKED;
|
||||
}
|
||||
if ((localPathType2 == PathType.RAIL)
|
||||
&& (!(paramIBlockAccess.getType(localBlockPosition)
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract))
|
||||
&& (!(paramIBlockAccess.getType(localBlockPosition.down())
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract))) {
|
||||
if (localPathType2 == PathType.RAIL
|
||||
&& !(paramIBlockAccess.getType(localBlockPosition)
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract)
|
||||
&& !(paramIBlockAccess.getType(localBlockPosition.down())
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract)) {
|
||||
localPathType2 = PathType.FENCE;
|
||||
}
|
||||
if ((i == paramInt1) && (k == paramInt2) && (m == paramInt3)) {
|
||||
if (i == paramInt1 && k == paramInt2 && m == paramInt3) {
|
||||
localObject1 = localPathType2;
|
||||
}
|
||||
if ((k > paramInt2) && (localPathType2 != PathType.OPEN)) {
|
||||
if (k > paramInt2 && localPathType2 != PathType.OPEN) {
|
||||
AxisAlignedBB localAxisAlignedBB = new AxisAlignedBB(i - d + 0.5D, paramInt2 + 0.001D,
|
||||
m - d + 0.5D, i + d + 0.5D, paramInt2 + paramEntityInsentient.length, m + d + 0.5D);
|
||||
if (!paramEntityInsentient.world.b(localAxisAlignedBB)) {
|
||||
@ -121,21 +121,18 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localEnumSet.contains(PathType.FENCE)) {
|
||||
if (localEnumSet.contains(PathType.FENCE))
|
||||
return PathType.FENCE;
|
||||
}
|
||||
Object localObject2 = PathType.BLOCKED;
|
||||
for (PathType localPathType1 : localEnumSet) {
|
||||
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
|
||||
if (paramEntityInsentient.a(localPathType1) < 0.0F)
|
||||
return localPathType1;
|
||||
}
|
||||
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a((PathType) localObject2)) {
|
||||
localObject2 = localPathType1;
|
||||
}
|
||||
}
|
||||
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject2) == 0.0F)) {
|
||||
if (localObject1 == PathType.OPEN && paramEntityInsentient.a((PathType) localObject2) == 0.0F)
|
||||
return PathType.OPEN;
|
||||
}
|
||||
return (PathType) localObject2;
|
||||
}
|
||||
|
||||
@ -151,23 +148,23 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
for (int k = paramInt2; k < paramInt2 + paramInt5; k++) {
|
||||
for (int m = paramInt3; m < paramInt3 + paramInt6; m++) {
|
||||
PathType localPathType2 = a(paramIBlockAccess, i, k, m);
|
||||
if ((localPathType2 == PathType.DOOR_WOOD_CLOSED) && (paramBoolean1) && (paramBoolean2)) {
|
||||
if (localPathType2 == PathType.DOOR_WOOD_CLOSED && paramBoolean1 && paramBoolean2) {
|
||||
localPathType2 = PathType.WALKABLE;
|
||||
}
|
||||
if ((localPathType2 == PathType.DOOR_OPEN) && (!paramBoolean2)) {
|
||||
if (localPathType2 == PathType.DOOR_OPEN && !paramBoolean2) {
|
||||
localPathType2 = PathType.BLOCKED;
|
||||
}
|
||||
if ((localPathType2 == PathType.RAIL)
|
||||
&& (!(paramIBlockAccess.getType(localBlockPosition)
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract))
|
||||
&& (!(paramIBlockAccess.getType(localBlockPosition.down())
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract))) {
|
||||
if (localPathType2 == PathType.RAIL
|
||||
&& !(paramIBlockAccess.getType(localBlockPosition)
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract)
|
||||
&& !(paramIBlockAccess.getType(localBlockPosition.down())
|
||||
.getBlock() instanceof BlockMinecartTrackAbstract)) {
|
||||
localPathType2 = PathType.FENCE;
|
||||
}
|
||||
if ((i == paramInt1) && (k == paramInt2) && (m == paramInt3)) {
|
||||
if (i == paramInt1 && k == paramInt2 && m == paramInt3) {
|
||||
localObject1 = localPathType2;
|
||||
}
|
||||
if ((k > paramInt2) && (localPathType2 != PathType.OPEN)) {
|
||||
if (k > paramInt2 && localPathType2 != PathType.OPEN) {
|
||||
AxisAlignedBB localAxisAlignedBB = new AxisAlignedBB(i - d + 0.5D, paramInt2 + 0.001D,
|
||||
m - d + 0.5D, i + d + 0.5D, paramInt2 + paramEntityInsentient.length, m + d + 0.5D);
|
||||
if (!paramEntityInsentient.world.b(localAxisAlignedBB)) {
|
||||
@ -178,21 +175,18 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (localEnumSet.contains(PathType.FENCE)) {
|
||||
if (localEnumSet.contains(PathType.FENCE))
|
||||
return PathType.FENCE;
|
||||
}
|
||||
Object localObject2 = PathType.BLOCKED;
|
||||
for (PathType localPathType1 : localEnumSet) {
|
||||
if (paramEntityInsentient.a(localPathType1) < 0.0F) {
|
||||
if (paramEntityInsentient.a(localPathType1) < 0.0F)
|
||||
return localPathType1;
|
||||
}
|
||||
if (paramEntityInsentient.a(localPathType1) >= paramEntityInsentient.a((PathType) localObject2)) {
|
||||
localObject2 = localPathType1;
|
||||
}
|
||||
}
|
||||
if ((localObject1 == PathType.OPEN) && (paramEntityInsentient.a((PathType) localObject2) == 0.0F)) {
|
||||
if (localObject1 == PathType.OPEN && paramEntityInsentient.a((PathType) localObject2) == 0.0F)
|
||||
return PathType.OPEN;
|
||||
}
|
||||
return (PathType) localObject2;
|
||||
}
|
||||
|
||||
@ -202,9 +196,8 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
BlockPosition localBlockPosition1 = new BlockPosition(paramInt1, paramInt2, paramInt3);
|
||||
BlockPosition localBlockPosition2 = localBlockPosition1.down();
|
||||
double d1 = paramInt2 - (1.0D - this.a.getType(localBlockPosition2).c(this.a, localBlockPosition2).e);
|
||||
if (d1 - paramDouble > 1.0D) {
|
||||
if (d1 - paramDouble > 1.0D)
|
||||
return null;
|
||||
}
|
||||
PathType localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
|
||||
float f = this.b.a(localPathType);
|
||||
double d2 = this.b.width / 2.0D;
|
||||
@ -213,14 +206,13 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
localPathPoint.m = localPathType;
|
||||
localPathPoint.l = Math.max(localPathPoint.l, f);
|
||||
}
|
||||
if (localPathType == PathType.WALKABLE) {
|
||||
if (localPathType == PathType.WALKABLE)
|
||||
return localPathPoint;
|
||||
}
|
||||
if ((localPathPoint == null) && (paramInt4 > 0) && (localPathType != PathType.FENCE)
|
||||
&& (localPathType != PathType.TRAPDOOR)) {
|
||||
if (localPathPoint == null && paramInt4 > 0 && localPathType != PathType.FENCE
|
||||
&& localPathType != PathType.TRAPDOOR) {
|
||||
localPathPoint = a(paramInt1, paramInt2 + 1, paramInt3, paramInt4 - 1, paramDouble, paramEnumDirection);
|
||||
if ((localPathPoint != null)
|
||||
&& ((localPathPoint.m == PathType.OPEN) || (localPathPoint.m == PathType.WALKABLE))) {
|
||||
if (localPathPoint != null
|
||||
&& (localPathPoint.m == PathType.OPEN || localPathPoint.m == PathType.WALKABLE)) {
|
||||
double d3 = paramInt1 - paramEnumDirection.getAdjacentX() + 0.5D;
|
||||
double d4 = paramInt3 - paramEnumDirection.getAdjacentZ() + 0.5D;
|
||||
AxisAlignedBB localAxisAlignedBB1 = new AxisAlignedBB(d3 - d2, paramInt2 + 0.001D, d4 - d2, d3 + d2,
|
||||
@ -235,24 +227,21 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
if (localPathType == PathType.OPEN) {
|
||||
AxisAlignedBB localAxisAlignedBB4 = new AxisAlignedBB(paramInt1 - d2 + 0.5D, paramInt2 + 0.001D,
|
||||
paramInt3 - d2 + 0.5D, paramInt1 + d2 + 0.5D, paramInt2 + this.b.length, paramInt3 + d2 + 0.5D);
|
||||
if (this.b.world.b(localAxisAlignedBB4)) {
|
||||
if (this.b.world.b(localAxisAlignedBB4))
|
||||
return null;
|
||||
}
|
||||
int i = 0;
|
||||
while ((paramInt2 > 0) && (localPathType == PathType.OPEN)) {
|
||||
while (paramInt2 > 0 && localPathType == PathType.OPEN) {
|
||||
paramInt2--;
|
||||
if (i++ >= b.aY()) {
|
||||
if (i++ >= b.aY())
|
||||
return null;
|
||||
}
|
||||
localPathType = a(this.b, paramInt1, paramInt2, paramInt3);
|
||||
f = this.b.a(localPathType);
|
||||
if ((localPathType != PathType.OPEN) && (f >= 0.0F)) {
|
||||
if (localPathType != PathType.OPEN && f >= 0.0F) {
|
||||
localPathPoint = a(paramInt1, paramInt2, paramInt3);
|
||||
localPathPoint.m = localPathType;
|
||||
localPathPoint.l = Math.max(localPathPoint.l, f);
|
||||
} else if (f < 0.0F) {
|
||||
} else if (f < 0.0F)
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
return localPathPoint;
|
||||
@ -278,57 +267,49 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
EnumDirection.EAST);
|
||||
PathPoint localPathPoint4 = a(paramPathPoint1.a, paramPathPoint1.b, paramPathPoint1.c - 1, k, d,
|
||||
EnumDirection.NORTH);
|
||||
if ((localPathPoint1 != null) && (!localPathPoint1.i) && (localPathPoint1.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint1;
|
||||
if (localPathPoint1 != null && !localPathPoint1.i && localPathPoint1.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint1;
|
||||
}
|
||||
if ((localPathPoint2 != null) && (!localPathPoint2.i) && (localPathPoint2.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint2;
|
||||
if (localPathPoint2 != null && !localPathPoint2.i && localPathPoint2.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint2;
|
||||
}
|
||||
if ((localPathPoint3 != null) && (!localPathPoint3.i) && (localPathPoint3.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint3;
|
||||
if (localPathPoint3 != null && !localPathPoint3.i && localPathPoint3.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint3;
|
||||
}
|
||||
if ((localPathPoint4 != null) && (!localPathPoint4.i) && (localPathPoint4.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint4;
|
||||
if (localPathPoint4 != null && !localPathPoint4.i && localPathPoint4.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint4;
|
||||
}
|
||||
int m = (localPathPoint4 == null) || (localPathPoint4.m == PathType.OPEN) || (localPathPoint4.l != 0.0F) ? 1
|
||||
: 0;
|
||||
int n = (localPathPoint1 == null) || (localPathPoint1.m == PathType.OPEN) || (localPathPoint1.l != 0.0F) ? 1
|
||||
: 0;
|
||||
int i1 = (localPathPoint3 == null) || (localPathPoint3.m == PathType.OPEN) || (localPathPoint3.l != 0.0F) ? 1
|
||||
: 0;
|
||||
int i2 = (localPathPoint2 == null) || (localPathPoint2.m == PathType.OPEN) || (localPathPoint2.l != 0.0F) ? 1
|
||||
: 0;
|
||||
int m = localPathPoint4 == null || localPathPoint4.m == PathType.OPEN || localPathPoint4.l != 0.0F ? 1 : 0;
|
||||
int n = localPathPoint1 == null || localPathPoint1.m == PathType.OPEN || localPathPoint1.l != 0.0F ? 1 : 0;
|
||||
int i1 = localPathPoint3 == null || localPathPoint3.m == PathType.OPEN || localPathPoint3.l != 0.0F ? 1 : 0;
|
||||
int i2 = localPathPoint2 == null || localPathPoint2.m == PathType.OPEN || localPathPoint2.l != 0.0F ? 1 : 0;
|
||||
PathPoint localPathPoint5;
|
||||
if ((m != 0) && (i2 != 0)) {
|
||||
if (m != 0 && i2 != 0) {
|
||||
localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d,
|
||||
EnumDirection.NORTH);
|
||||
if ((localPathPoint5 != null) && (!localPathPoint5.i)
|
||||
&& (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint5;
|
||||
if (localPathPoint5 != null && !localPathPoint5.i && localPathPoint5.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint5;
|
||||
}
|
||||
}
|
||||
if ((m != 0) && (i1 != 0)) {
|
||||
if (m != 0 && i1 != 0) {
|
||||
localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c - 1, k, d,
|
||||
EnumDirection.NORTH);
|
||||
if ((localPathPoint5 != null) && (!localPathPoint5.i)
|
||||
&& (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint5;
|
||||
if (localPathPoint5 != null && !localPathPoint5.i && localPathPoint5.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint5;
|
||||
}
|
||||
}
|
||||
if ((n != 0) && (i2 != 0)) {
|
||||
if (n != 0 && i2 != 0) {
|
||||
localPathPoint5 = a(paramPathPoint1.a - 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d,
|
||||
EnumDirection.SOUTH);
|
||||
if ((localPathPoint5 != null) && (!localPathPoint5.i)
|
||||
&& (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint5;
|
||||
if (localPathPoint5 != null && !localPathPoint5.i && localPathPoint5.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint5;
|
||||
}
|
||||
}
|
||||
if ((n != 0) && (i1 != 0)) {
|
||||
if (n != 0 && i1 != 0) {
|
||||
localPathPoint5 = a(paramPathPoint1.a + 1, paramPathPoint1.b, paramPathPoint1.c + 1, k, d,
|
||||
EnumDirection.SOUTH);
|
||||
if ((localPathPoint5 != null) && (!localPathPoint5.i)
|
||||
&& (localPathPoint5.a(paramPathPoint2) < paramFloat)) {
|
||||
paramArrayOfPathPoint[(i++)] = localPathPoint5;
|
||||
if (localPathPoint5 != null && !localPathPoint5.i && localPathPoint5.a(paramPathPoint2) < paramFloat) {
|
||||
paramArrayOfPathPoint[i++] = localPathPoint5;
|
||||
}
|
||||
}
|
||||
return i;
|
||||
@ -338,12 +319,12 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
public PathPoint b() {
|
||||
int i;
|
||||
BlockPosition localObject1;
|
||||
if ((e()) && (this.b.isInWater())) {
|
||||
if (e() && this.b.isInWater()) {
|
||||
i = (int) this.b.getBoundingBox().b;
|
||||
localObject1 = new BlockPosition.MutableBlockPosition(MathHelper.floor(this.b.locX), i,
|
||||
MathHelper.floor(this.b.locZ));
|
||||
Block localObject2 = this.a.getType(localObject1).getBlock();
|
||||
while ((localObject2 == Blocks.FLOWING_WATER) || (localObject2 == Blocks.WATER)) {
|
||||
while (localObject2 == Blocks.FLOWING_WATER || localObject2 == Blocks.WATER) {
|
||||
i++;
|
||||
((MutableBlockPosition) localObject1).c(MathHelper.floor(this.b.locX), i,
|
||||
MathHelper.floor(this.b.locZ));
|
||||
@ -351,9 +332,8 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
}
|
||||
} else if (!this.b.onGround) {
|
||||
localObject1 = new BlockPosition(this.b);
|
||||
while (((this.a.getType(localObject1).getMaterial() == Material.AIR)
|
||||
|| (this.a.getType(localObject1).getBlock().b(this.a, localObject1)))
|
||||
&& (localObject1.getY() > 0)) {
|
||||
while ((this.a.getType(localObject1).getMaterial() == Material.AIR
|
||||
|| this.a.getType(localObject1).getBlock().b(this.a, localObject1)) && localObject1.getY() > 0) {
|
||||
localObject1 = localObject1.down();
|
||||
}
|
||||
i = localObject1.up().getY();
|
||||
@ -363,16 +343,15 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
localObject1 = new BlockPosition(this.b);
|
||||
Object localObject2 = a(this.b, localObject1.getX(), i, localObject1.getZ());
|
||||
if (this.b.a((PathType) localObject2) < 0.0F) {
|
||||
HashSet<BlockPosition> localHashSet = new HashSet<BlockPosition>();
|
||||
HashSet<BlockPosition> localHashSet = new HashSet<>();
|
||||
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().c));
|
||||
localHashSet.add(new BlockPosition(this.b.getBoundingBox().a, i, this.b.getBoundingBox().f));
|
||||
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().c));
|
||||
localHashSet.add(new BlockPosition(this.b.getBoundingBox().d, i, this.b.getBoundingBox().f));
|
||||
for (BlockPosition localBlockPosition : localHashSet) {
|
||||
PathType localPathType = a(this.b, localBlockPosition);
|
||||
if (this.b.a(localPathType) >= 0.0F) {
|
||||
if (this.b.a(localPathType) >= 0.0F)
|
||||
return a(localBlockPosition.getX(), localBlockPosition.getY(), localBlockPosition.getZ());
|
||||
}
|
||||
}
|
||||
}
|
||||
return a(localObject1.getX(), i, localObject1.getZ());
|
||||
@ -384,46 +363,34 @@ public class PlayerPathfinderNormal extends PlayerPathfinderAbstract {
|
||||
Block localBlock1 = localIBlockData.getBlock();
|
||||
Material localMaterial = localIBlockData.getMaterial();
|
||||
PathType localPathType1 = PathType.BLOCKED;
|
||||
if ((localBlock1 == Blocks.TRAPDOOR) || (localBlock1 == Blocks.IRON_TRAPDOOR)
|
||||
|| (localBlock1 == Blocks.WATERLILY)) {
|
||||
if (localBlock1 == Blocks.TRAPDOOR || localBlock1 == Blocks.IRON_TRAPDOOR || localBlock1 == Blocks.WATERLILY)
|
||||
return PathType.TRAPDOOR;
|
||||
}
|
||||
if (localBlock1 == Blocks.FIRE) {
|
||||
if (localBlock1 == Blocks.FIRE)
|
||||
return PathType.DAMAGE_FIRE;
|
||||
}
|
||||
if (localBlock1 == Blocks.CACTUS) {
|
||||
if (localBlock1 == Blocks.CACTUS)
|
||||
return PathType.DAMAGE_CACTUS;
|
||||
}
|
||||
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.WOOD)
|
||||
&& (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
|
||||
if (localBlock1 instanceof BlockDoor && localMaterial == Material.WOOD
|
||||
&& !localIBlockData.get(BlockDoor.OPEN).booleanValue())
|
||||
return PathType.DOOR_WOOD_CLOSED;
|
||||
}
|
||||
if (((localBlock1 instanceof BlockDoor)) && (localMaterial == Material.ORE)
|
||||
&& (!localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
|
||||
if (localBlock1 instanceof BlockDoor && localMaterial == Material.ORE
|
||||
&& !localIBlockData.get(BlockDoor.OPEN).booleanValue())
|
||||
return PathType.DOOR_IRON_CLOSED;
|
||||
}
|
||||
if (((localBlock1 instanceof BlockDoor)) && (localIBlockData.get(BlockDoor.OPEN).booleanValue())) {
|
||||
if (localBlock1 instanceof BlockDoor && localIBlockData.get(BlockDoor.OPEN).booleanValue())
|
||||
return PathType.DOOR_OPEN;
|
||||
}
|
||||
if ((localBlock1 instanceof BlockMinecartTrackAbstract)) {
|
||||
if (localBlock1 instanceof BlockMinecartTrackAbstract)
|
||||
return PathType.RAIL;
|
||||
}
|
||||
if (((localBlock1 instanceof BlockFence)) || ((localBlock1 instanceof BlockCobbleWall))
|
||||
|| (((localBlock1 instanceof BlockFenceGate))
|
||||
&& (!localIBlockData.get(BlockFenceGate.OPEN).booleanValue()))) {
|
||||
if (localBlock1 instanceof BlockFence || localBlock1 instanceof BlockCobbleWall
|
||||
|| localBlock1 instanceof BlockFenceGate && !localIBlockData.get(BlockFenceGate.OPEN).booleanValue())
|
||||
return PathType.FENCE;
|
||||
}
|
||||
if (localMaterial == Material.AIR) {
|
||||
localPathType1 = PathType.OPEN;
|
||||
} else {
|
||||
if (localMaterial == Material.WATER) {
|
||||
if (localMaterial == Material.WATER)
|
||||
return PathType.WATER;
|
||||
}
|
||||
if (localMaterial == Material.LAVA) {
|
||||
if (localMaterial == Material.LAVA)
|
||||
return PathType.LAVA;
|
||||
}
|
||||
}
|
||||
if ((localBlock1.b(paramIBlockAccess, localBlockPosition)) && (localPathType1 == PathType.BLOCKED)) {
|
||||
if (localBlock1.b(paramIBlockAccess, localBlockPosition) && localPathType1 == PathType.BLOCKED) {
|
||||
localPathType1 = PathType.OPEN;
|
||||
}
|
||||
return localPathType1;
|
||||
|
@ -46,9 +46,9 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
|
||||
|
||||
if (entityplayer != tracker && c(entityplayer)) {
|
||||
if (!this.trackedPlayers.contains(entityplayer)
|
||||
&& ((entityplayer.x().getPlayerChunkMap().a(entityplayer, tracker.ac, tracker.ae))
|
||||
|| (tracker.attachedToPlayer))) {
|
||||
if ((tracker instanceof SkinnableEntity)) {
|
||||
&& (entityplayer.x().getPlayerChunkMap().a(entityplayer, tracker.ac, tracker.ae)
|
||||
|| tracker.attachedToPlayer)) {
|
||||
if (tracker instanceof SkinnableEntity) {
|
||||
SkinnableEntity skinnable = (SkinnableEntity) tracker;
|
||||
Player player = skinnable.getBukkitEntity();
|
||||
if (!entityplayer.getBukkitEntity().canSee(player))
|
||||
@ -65,9 +65,8 @@ public class PlayerlistTrackerEntry extends EntityTrackerEntry {
|
||||
private static int getE(EntityTrackerEntry entry) {
|
||||
try {
|
||||
Entity entity = getTracker(entry);
|
||||
if (entity instanceof NPCHolder) {
|
||||
if (entity instanceof NPCHolder)
|
||||
return ((NPCHolder) entity).getNPC().data().get(NPC.Metadata.TRACKING_RANGE, (Integer) E.get(entry));
|
||||
}
|
||||
return (Integer) E.get(entry);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -66,9 +66,8 @@ public class ArmorStandController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
if (npc == null)
|
||||
return super.a(entityhuman, vec3d, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
@ -67,7 +67,7 @@ public class BatController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
|
@ -64,7 +64,7 @@ public class BlazeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -176,11 +176,10 @@ public class CaveSpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -82,7 +82,7 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -185,11 +185,10 @@ public class ChickenController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -86,7 +86,7 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -95,9 +95,8 @@ public class CowController extends MobEntityController {
|
||||
if (npc == null || !npc.isProtected())
|
||||
return super.a(entityhuman, enumhand);
|
||||
ItemStack itemstack = entityhuman.b(enumhand);
|
||||
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby()) {
|
||||
if (itemstack.getItem() == Items.BUCKET && !entityhuman.abilities.canInstantlyBuild && !this.isBaby())
|
||||
return false;
|
||||
}
|
||||
return super.a(entityhuman, enumhand);
|
||||
}
|
||||
|
||||
@ -200,11 +199,10 @@ public class CowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -76,7 +76,7 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -105,8 +105,9 @@ public class CreeperController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -185,11 +186,10 @@ public class CreeperController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -71,7 +71,7 @@ public class EnderDragonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -100,8 +100,9 @@ public class EnderDragonController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,7 +73,7 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -102,8 +102,9 @@ public class EndermanController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -160,9 +161,8 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean j(double d1, double d2, double d3) {
|
||||
if (npc == null) {
|
||||
if (npc == null)
|
||||
return super.j(d1, d2, d3);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -183,11 +183,10 @@ public class EndermanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,7 +73,7 @@ public class EndermiteController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -102,8 +102,9 @@ public class EndermiteController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -168,17 +169,17 @@ public class EndermiteController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -97,9 +97,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public boolean a(EntityPlayer entityplayer) {
|
||||
if (npc != null && !isTracked) {
|
||||
if (npc != null && !isTracked)
|
||||
return false;
|
||||
}
|
||||
return super.a(entityplayer);
|
||||
}
|
||||
|
||||
@ -151,12 +150,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
boolean damaged = super.damageEntity(damagesource, f);
|
||||
if (damaged && velocityChanged) {
|
||||
velocityChanged = false;
|
||||
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
EntityHumanNPC.this.velocityChanged = true;
|
||||
}
|
||||
});
|
||||
Bukkit.getScheduler().runTask(CitizensAPI.getPlugin(), () -> EntityHumanNPC.this.velocityChanged = true);
|
||||
}
|
||||
return damaged;
|
||||
}
|
||||
@ -165,16 +159,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
public void die(DamageSource damagesource) {
|
||||
// players that die are not normally removed from the world. when the
|
||||
// NPC dies, we are done with the instance and it should be removed.
|
||||
if (dead) {
|
||||
if (dead)
|
||||
return;
|
||||
}
|
||||
super.die(damagesource);
|
||||
Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
world.removeEntity(EntityHumanNPC.this);
|
||||
}
|
||||
}, 15); // give enough time for death and smoke animation
|
||||
Bukkit.getScheduler().runTaskLater(CitizensAPI.getPlugin(), () -> world.removeEntity(EntityHumanNPC.this), 15); // give enough time for death and smoke animation
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -228,9 +216,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public IChatBaseComponent getPlayerListName() {
|
||||
if (Setting.DISABLE_TABLIST.asBoolean()) {
|
||||
if (Setting.DISABLE_TABLIST.asBoolean())
|
||||
return new ChatComponentText("");
|
||||
}
|
||||
return super.getPlayerListName();
|
||||
}
|
||||
|
||||
@ -250,9 +237,8 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public boolean inBlock() {
|
||||
if (npc == null || noclip || isSleeping()) {
|
||||
if (npc == null || noclip || isSleeping())
|
||||
return super.inBlock();
|
||||
}
|
||||
return Util.inBlock(getBukkitEntity());
|
||||
}
|
||||
|
||||
@ -289,11 +275,10 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void moveOnCurrentHeading() {
|
||||
@ -410,7 +395,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
for (EnumItemSlot slot : EnumItemSlot.values()) {
|
||||
ItemStack equipment = getEquipment(slot);
|
||||
ItemStack cache = equipmentCache.get(slot);
|
||||
if (!(cache == null && equipment == null)
|
||||
if (((cache != null) || (equipment != null))
|
||||
&& (cache == null ^ equipment == null || !ItemStack.equals(cache, equipment))) {
|
||||
itemChanged = true;
|
||||
if (cache != null && !cache.isEmpty()) {
|
||||
|
@ -59,7 +59,7 @@ public class EvokerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -162,11 +162,10 @@ public class EvokerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ public class GhastController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class GiantController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,11 +162,10 @@ public class GiantController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -154,11 +154,10 @@ public class GuardianController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class GuardianElderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -154,11 +154,10 @@ public class GuardianElderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -48,6 +48,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
private final CitizensNPC npc;
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -84,7 +85,7 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -198,11 +199,10 @@ public class HorseController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
|
||||
private final CitizensNPC npc;
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseDonkeyNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -86,7 +87,7 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -200,11 +201,10 @@ public class HorseDonkeyController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ public class HorseMuleController extends MobEntityController {
|
||||
|
||||
private final CitizensNPC npc;
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseMuleNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -86,7 +87,7 @@ public class HorseMuleController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -200,11 +201,10 @@ public class HorseMuleController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
|
||||
private final CitizensNPC npc;
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseSkeletonNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -86,7 +87,7 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -200,11 +201,10 @@ public class HorseSkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,7 @@ public class HorseZombieController extends MobEntityController {
|
||||
|
||||
private final CitizensNPC npc;
|
||||
private boolean riding;
|
||||
|
||||
public EntityHorseZombieNPC(World world) {
|
||||
this(world, null);
|
||||
}
|
||||
@ -86,7 +87,7 @@ public class HorseZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -200,11 +201,10 @@ public class HorseZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,6 @@ import net.minecraft.server.v1_11_R1.WorldServer;
|
||||
|
||||
public class HumanController extends AbstractEntityController {
|
||||
public HumanController() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -46,16 +45,13 @@ public class HumanController extends AbstractEntityController {
|
||||
if (skin != null) {
|
||||
skin.apply(handle);
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (getBukkitEntity() == null || !getBukkitEntity().isValid()
|
||||
|| getBukkitEntity() != handle.getBukkitEntity())
|
||||
return;
|
||||
boolean removeFromPlayerList = npc.data().get("removefromplayerlist",
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(), removeFromPlayerList);
|
||||
}
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), () -> {
|
||||
if (getBukkitEntity() == null || !getBukkitEntity().isValid()
|
||||
|| getBukkitEntity() != handle.getBukkitEntity())
|
||||
return;
|
||||
boolean removeFromPlayerList = npc.data().get("removefromplayerlist",
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
NMS.addOrRemoveFromPlayerList(getBukkitEntity(), removeFromPlayerList);
|
||||
}, 20);
|
||||
handle.getBukkitEntity().setSleepingIgnored(true);
|
||||
return handle.getBukkitEntity();
|
||||
|
@ -59,7 +59,7 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class IronGolemController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,11 +162,10 @@ public class IronGolemController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -79,7 +79,7 @@ public class LlamaController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -184,11 +184,10 @@ public class LlamaController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -102,8 +102,9 @@ public class MagmaCubeController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -174,11 +175,10 @@ public class MagmaCubeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +75,7 @@ public abstract class MobEntityController extends AbstractEntityController {
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<Class<?>, Constructor<?>> CONSTRUCTOR_CACHE = new WeakHashMap<Class<?>, Constructor<?>>();
|
||||
private static final Map<Class<?>, Constructor<?>> CONSTRUCTOR_CACHE = new WeakHashMap<>();
|
||||
private static final MethodHandle UUID_FIELD = NMS.getSetter(net.minecraft.server.v1_11_R1.Entity.class,
|
||||
"uniqueID");
|
||||
}
|
@ -70,7 +70,7 @@ public class MushroomCowController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -106,8 +106,9 @@ public class MushroomCowController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -172,17 +173,17 @@ public class MushroomCowController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class OcelotController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -97,8 +97,9 @@ public class OcelotController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -170,17 +171,17 @@ public class OcelotController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -178,11 +178,10 @@ public class PigController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class PigZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class PigZombieController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -161,11 +162,10 @@ public class PigZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class PolarBearController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -180,11 +180,10 @@ public class RabbitController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +68,7 @@ public class SheepController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -97,8 +97,9 @@ public class SheepController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -163,17 +164,17 @@ public class SheepController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -99,8 +99,9 @@ public class ShulkerController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -139,8 +140,9 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ShulkerNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -163,11 +165,10 @@ public class ShulkerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SilverfishController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SilverfishController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SilverfishController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SilverfishNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -153,17 +155,17 @@ public class SilverfishController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SkeletonController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SkeletonNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class SkeletonController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SkeletonStrayController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SkeletonStrayController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SkeletonStrayController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new StrayNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class SkeletonStrayController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SkeletonWitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SkeletonWitherController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SkeletonWitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SkeletonWitherNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class SkeletonWitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -65,7 +65,7 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -150,8 +150,9 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SlimeNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -174,11 +175,10 @@ public class SlimeController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SnowmanController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SnowmanNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class SnowmanController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SpiderController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SpiderController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SpiderNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -153,17 +155,17 @@ public class SpiderController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class SquidController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new SquidNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -152,11 +154,10 @@ public class SquidController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,7 +53,7 @@ public class VexController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -107,8 +107,9 @@ public class VexController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new VexNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -167,8 +167,9 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new VillagerNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -199,11 +200,10 @@ public class VillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,7 +68,7 @@ public class VindicatorController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -138,8 +138,9 @@ public class VindicatorController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new VindicatorNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -170,11 +171,10 @@ public class VindicatorController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class WitchController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class WitchController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class WitchController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new WitchNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -153,17 +155,17 @@ public class WitchController extends MobEntityController {
|
||||
@Override
|
||||
public void M() {
|
||||
super.M();
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
npc.update();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ public class WitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -79,8 +79,9 @@ public class WitherController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -109,8 +110,9 @@ public class WitherController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new WitherNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -140,8 +140,9 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new WolfNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -172,11 +173,10 @@ public class WolfController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +59,7 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class ZombieController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ZombieNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class ZombieController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class ZombieHuskController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class ZombieHuskController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class ZombieHuskController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ZombieHuskNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class ZombieHuskController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,7 @@ public class ZombieVillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public void a(Entity entity, float strength, double dx, double dz) {
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, (evt) -> super.a(entity, (float) evt.getStrength(),
|
||||
NMS.callKnockbackEvent(npc, strength, dx, dz, evt -> super.a(entity, (float) evt.getStrength(),
|
||||
evt.getKnockbackVector().getX(), evt.getKnockbackVector().getZ()));
|
||||
}
|
||||
|
||||
@ -88,8 +88,9 @@ public class ZombieVillagerController extends MobEntityController {
|
||||
// this method is called by both the entities involved - cancelling
|
||||
// it will not stop the NPC from moving.
|
||||
super.collide(entity);
|
||||
if (npc != null)
|
||||
if (npc != null) {
|
||||
Util.callCollisionEvent(npc, entity.getBukkitEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -128,8 +129,9 @@ public class ZombieVillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public CraftEntity getBukkitEntity() {
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder))
|
||||
if (npc != null && !(bukkitEntity instanceof NPCHolder)) {
|
||||
bukkitEntity = new ZombieVillagerNPC(this);
|
||||
}
|
||||
return super.getBukkitEntity();
|
||||
}
|
||||
|
||||
@ -160,11 +162,10 @@ public class ZombieVillagerController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
if (npc == null || !npc.isFlyable())
|
||||
return super.m_();
|
||||
} else {
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,8 @@ public class EvokerFangsController extends MobEntityController {
|
||||
|
||||
@Override
|
||||
public EnumInteractionResult a(EntityHuman entityhuman, Vec3D vec3d, EnumHand enumhand) {
|
||||
if (npc == null) {
|
||||
if (npc == null)
|
||||
return super.a(entityhuman, vec3d, enumhand);
|
||||
}
|
||||
PlayerInteractEntityEvent event = new PlayerInteractEntityEvent((Player) entityhuman.getBukkitEntity(),
|
||||
getBukkitEntity());
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
@ -37,13 +37,13 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker {
|
||||
|
||||
private float getStrength(IBlockData block) {
|
||||
float base = block.getBlock().a(block, null, new BlockPosition(0, 0, 0));
|
||||
return base < 0.0F ? 0.0F : (!isDestroyable(block) ? 1.0F / base / 100.0F : strengthMod(block) / base / 30.0F);
|
||||
return base < 0.0F ? 0.0F : !isDestroyable(block) ? 1.0F / base / 100.0F : strengthMod(block) / base / 30.0F;
|
||||
}
|
||||
|
||||
private boolean isDestroyable(IBlockData block) {
|
||||
if (block.getMaterial().isAlwaysDestroyable()) {
|
||||
if (block.getMaterial().isAlwaysDestroyable())
|
||||
return true;
|
||||
} else {
|
||||
else {
|
||||
ItemStack current = getCurrentItem();
|
||||
return current != null ? current.b(block) : false;
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class CitizensBlockBreaker extends AbstractBlockBreaker {
|
||||
}
|
||||
}
|
||||
if (handle.hasEffect(MobEffects.FASTER_DIG)) {
|
||||
f *= (1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F);
|
||||
f *= 1.0F + (handle.getEffect(MobEffects.FASTER_DIG).getAmplifier() + 1) * 0.2F;
|
||||
}
|
||||
if (handle.hasEffect(MobEffects.SLOWER_DIG)) {
|
||||
float f1 = 1.0F;
|
||||
|
@ -33,9 +33,8 @@ public class CustomEntityRegistry extends RegistryMaterials
|
||||
|
||||
@Override
|
||||
public int a(Object key) {
|
||||
if (entityIds.containsKey(key)) {
|
||||
if (entityIds.containsKey(key))
|
||||
return entityIds.get(key);
|
||||
}
|
||||
return wrapped.a((Class<? extends Entity>) key);
|
||||
}
|
||||
|
||||
@ -46,9 +45,8 @@ public class CustomEntityRegistry extends RegistryMaterials
|
||||
|
||||
@Override
|
||||
public MinecraftKey b(Object value) {
|
||||
if (entityClasses.containsKey(value)) {
|
||||
if (entityClasses.containsKey(value))
|
||||
return entityClasses.get(value);
|
||||
}
|
||||
return wrapped.b((Class<? extends Entity>) value);
|
||||
}
|
||||
|
||||
@ -64,9 +62,8 @@ public class CustomEntityRegistry extends RegistryMaterials
|
||||
|
||||
@Override
|
||||
public Class<? extends Entity> get(Object key) {
|
||||
if (entities.containsKey(key)) {
|
||||
if (entities.containsKey(key))
|
||||
return entities.get(key);
|
||||
}
|
||||
return wrapped.get((MinecraftKey) key);
|
||||
}
|
||||
|
||||
|
@ -411,9 +411,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (Bukkit.isPrimaryThread())
|
||||
throw new IllegalStateException("NMS.fillProfileProperties cannot be invoked from the main thread.");
|
||||
MinecraftSessionService sessionService = ((CraftServer) Bukkit.getServer()).getServer().az();
|
||||
if (!(sessionService instanceof YggdrasilMinecraftSessionService)) {
|
||||
if (!(sessionService instanceof YggdrasilMinecraftSessionService))
|
||||
return sessionService.fillProfileProperties(profile, requireSecure);
|
||||
}
|
||||
YggdrasilAuthenticationService auth = ((YggdrasilMinecraftSessionService) sessionService)
|
||||
.getAuthenticationService();
|
||||
URL url = HttpAuthenticationService
|
||||
@ -451,9 +450,8 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
if (bserver == null) {
|
||||
if (bserver == null)
|
||||
return null;
|
||||
}
|
||||
BossBar ret = Bukkit.createBossBar("", BarColor.BLUE, BarStyle.SEGMENTED_10);
|
||||
try {
|
||||
CRAFT_BOSSBAR_HANDLE_FIELD.set(ret, bserver);
|
||||
@ -484,9 +482,8 @@ public class NMSImpl implements NMSBridge {
|
||||
Entity handle = getHandle(entity);
|
||||
ControllerMove controller = handle instanceof EntityInsentient ? ((EntityInsentient) handle).getControllerMove()
|
||||
: handle instanceof EntityHumanNPC ? ((EntityHumanNPC) handle).getControllerMove() : null;
|
||||
if (controller == null || !controller.a()) {
|
||||
if (controller == null || !controller.a())
|
||||
return null;
|
||||
}
|
||||
return new Location(entity.getWorld(), controller.d(), controller.e(), controller.f());
|
||||
}
|
||||
|
||||
@ -497,9 +494,8 @@ public class NMSImpl implements NMSBridge {
|
||||
|
||||
@Override
|
||||
public float getHeadYaw(org.bukkit.entity.Entity entity) {
|
||||
if (!(entity instanceof LivingEntity)) {
|
||||
if (!(entity instanceof LivingEntity))
|
||||
return entity.getLocation().getYaw();
|
||||
}
|
||||
return getHandle((LivingEntity) entity).aP;
|
||||
}
|
||||
|
||||
@ -560,7 +556,7 @@ public class NMSImpl implements NMSBridge {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (handle == null || handle.passengers == null)
|
||||
return Lists.newArrayList();
|
||||
return Lists.transform(handle.passengers, input -> input.getBukkitEntity());
|
||||
return Lists.transform(handle.passengers, Entity::getBukkitEntity);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -608,8 +604,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!npc.isSpawned() || !(npc.getEntity() instanceof LivingEntity))
|
||||
return DEFAULT_SPEED;
|
||||
EntityLiving handle = NMSImpl.getHandle((LivingEntity) npc.getEntity());
|
||||
if (handle == null)
|
||||
return DEFAULT_SPEED;
|
||||
if (handle == null) {
|
||||
}
|
||||
return DEFAULT_SPEED;
|
||||
// return (float)
|
||||
// handle.getAttributeInstance(GenericAttributes.d).getValue();
|
||||
@ -627,23 +623,14 @@ public class NMSImpl implements NMSBridge {
|
||||
Iterables.transform(dest,
|
||||
input -> new PathPoint(input.getBlockX(), input.getBlockY(), input.getBlockZ())),
|
||||
PathPoint.class));
|
||||
return getTargetNavigator(entity, params, new Function<NavigationAbstract, Boolean>() {
|
||||
@Override
|
||||
public Boolean apply(NavigationAbstract input) {
|
||||
return input.a(path, params.speed());
|
||||
}
|
||||
});
|
||||
return getTargetNavigator(entity, params, input -> input.a(path, params.speed()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public MCNavigator getTargetNavigator(final org.bukkit.entity.Entity entity, final Location dest,
|
||||
final NavigatorParameters params) {
|
||||
return getTargetNavigator(entity, params, new Function<NavigationAbstract, Boolean>() {
|
||||
@Override
|
||||
public Boolean apply(NavigationAbstract input) {
|
||||
return input.a(dest.getX(), dest.getY(), dest.getZ(), params.speed());
|
||||
}
|
||||
});
|
||||
return getTargetNavigator(entity, params,
|
||||
input -> input.a(dest.getX(), dest.getY(), dest.getZ(), params.speed()));
|
||||
}
|
||||
|
||||
private MCNavigator getTargetNavigator(final org.bukkit.entity.Entity entity, final NavigatorParameters params,
|
||||
@ -737,11 +724,10 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public org.bukkit.entity.Entity getVehicle(org.bukkit.entity.Entity entity) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (handle == null) {
|
||||
if (handle == null)
|
||||
return null;
|
||||
}
|
||||
Entity e = handle.getVehicle();
|
||||
return (e == handle || e == null) ? null : e.getBukkitEntity();
|
||||
return e == handle || e == null ? null : e.getBukkitEntity();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -890,7 +876,7 @@ public class NMSImpl implements NMSBridge {
|
||||
public void look(org.bukkit.entity.Entity entity, Location to, boolean headOnly, boolean immediate) {
|
||||
Entity handle = NMSImpl.getHandle(entity);
|
||||
if (immediate || headOnly || BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
|| !(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC)) {
|
||||
Location fromLocation = entity.getLocation(FROM_LOCATION);
|
||||
double xDiff, yDiff, zDiff;
|
||||
xDiff = to.getX() - fromLocation.getX();
|
||||
@ -900,8 +886,9 @@ public class NMSImpl implements NMSBridge {
|
||||
double distanceY = Math.sqrt(distanceXZ * distanceXZ + yDiff * yDiff);
|
||||
double yaw = Math.toDegrees(Math.acos(xDiff / distanceXZ));
|
||||
double pitch = Math.toDegrees(Math.acos(yDiff / distanceY)) - 90;
|
||||
if (zDiff < 0.0)
|
||||
if (zDiff < 0.0) {
|
||||
yaw += Math.abs(180 - yaw) * 2;
|
||||
}
|
||||
if (handle instanceof EntityEnderDragon) {
|
||||
yaw = Util.getDragonYaw(handle.getBukkitEntity(), xDiff, zDiff);
|
||||
} else {
|
||||
@ -932,7 +919,7 @@ 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);
|
||||
if (BAD_CONTROLLER_LOOK.contains(handle.getBukkitEntity().getType())
|
||||
|| (!(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC))) {
|
||||
|| !(handle instanceof EntityInsentient) && !(handle instanceof EntityHumanNPC)) {
|
||||
if (to instanceof LivingEntity) {
|
||||
look(from, ((LivingEntity) to).getEyeLocation(), false, true);
|
||||
} else {
|
||||
@ -979,8 +966,6 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public CraftInventoryView getBukkitView() {
|
||||
if (this.bukkitEntity != null) {
|
||||
return this.bukkitEntity;
|
||||
} else {
|
||||
try {
|
||||
this.bukkitEntity = new CraftInventoryView(player,
|
||||
new CitizensInventoryAnvil(new Location(player.getWorld(), 0, 0, 0),
|
||||
@ -991,8 +976,8 @@ public class NMSImpl implements NMSBridge {
|
||||
e.printStackTrace();
|
||||
return super.getBukkitView();
|
||||
}
|
||||
return this.bukkitEntity;
|
||||
}
|
||||
return this.bukkitEntity;
|
||||
}
|
||||
};
|
||||
container.windowId = handle.nextContainerCounter();
|
||||
@ -1030,12 +1015,11 @@ public class NMSImpl implements NMSBridge {
|
||||
boolean removeFromPlayerList = ((NPCHolder) entity).getNPC().data().get("removefromplayerlist",
|
||||
Setting.REMOVE_PLAYERS_FROM_PLAYER_LIST.asBoolean());
|
||||
entity.playerTick();
|
||||
if (!removeFromPlayerList) {
|
||||
if (!removeFromPlayerList)
|
||||
return;
|
||||
}
|
||||
Entity entity1 = entity.bB();
|
||||
if (entity1 != null) {
|
||||
if ((entity1.dead) || (!entity1.w(entity))) {
|
||||
if (entity1.dead || !entity1.w(entity)) {
|
||||
entity.stopRiding();
|
||||
}
|
||||
} else {
|
||||
@ -1069,8 +1053,9 @@ public class NMSImpl implements NMSBridge {
|
||||
Class<?> search = clazz;
|
||||
while ((search = search.getSuperclass()) != null && Entity.class.isAssignableFrom(search)) {
|
||||
MinecraftKey key = ENTITY_REGISTRY.b(search);
|
||||
if (key == null)
|
||||
if (key == null) {
|
||||
continue;
|
||||
}
|
||||
int code = ENTITY_REGISTRY.a(search);
|
||||
ENTITY_REGISTRY.put(code, key, (Class<? extends Entity>) clazz);
|
||||
return;
|
||||
@ -1406,8 +1391,8 @@ public class NMSImpl implements NMSBridge {
|
||||
EntityPlayer from = (EntityPlayer) getHandle(entity);
|
||||
PerPlayerMetadata<Long> meta = CitizensAPI.getLocationLookup().registerMetadata("sleeping", null);
|
||||
if (sleep) {
|
||||
List<Player> nearbyPlayers = Lists.newArrayList(Iterables
|
||||
.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), (p) -> {
|
||||
List<Player> nearbyPlayers = Lists.newArrayList(
|
||||
Iterables.filter(CitizensAPI.getLocationLookup().getNearbyPlayers(entity.getLocation(), 64), p -> {
|
||||
Long time = meta.getMarker(p.getUniqueId(), entity.getUniqueId().toString());
|
||||
if (time == null || Math.abs(System.currentTimeMillis() - time) > 5000)
|
||||
return true;
|
||||
@ -1446,7 +1431,7 @@ public class NMSImpl implements NMSBridge {
|
||||
list.add(new PacketPlayOutEntityTeleport(from));
|
||||
for (Player nearby : nearbyPlayers) {
|
||||
nearby.sendBlockChange(bedLoc, Material.BED_BLOCK, facingByte);
|
||||
list.forEach((packet) -> sendPacket(nearby, packet));
|
||||
list.forEach(packet -> sendPacket(nearby, packet));
|
||||
meta.set(nearby.getUniqueId(), entity.getUniqueId().toString(), System.currentTimeMillis());
|
||||
}
|
||||
} else {
|
||||
@ -1575,9 +1560,8 @@ public class NMSImpl implements NMSBridge {
|
||||
@Override
|
||||
public void setPath() {
|
||||
Location location = parameters.entityTargetLocationMapper().apply(target);
|
||||
if (location == null) {
|
||||
if (location == null)
|
||||
throw new IllegalStateException("mapper should not return null");
|
||||
}
|
||||
navigation.a(location.getX(), location.getY(), location.getZ(), parameters.speed());
|
||||
}
|
||||
|
||||
@ -1650,9 +1634,8 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
private static CompoundTag convertNBT(net.minecraft.server.v1_11_R1.NBTTagCompound tag) {
|
||||
if (tag == null) {
|
||||
if (tag == null)
|
||||
return new CompoundTag("", Collections.EMPTY_MAP);
|
||||
}
|
||||
Map<String, Tag> tags = Maps.newHashMap();
|
||||
for (String key : tag.c()) {
|
||||
tags.put(key, convertNBT(key, tag.get(key)));
|
||||
@ -1661,25 +1644,25 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
private static Tag convertNBT(String key, net.minecraft.server.v1_11_R1.NBTBase base) {
|
||||
if (base instanceof net.minecraft.server.v1_11_R1.NBTTagInt) {
|
||||
if (base instanceof net.minecraft.server.v1_11_R1.NBTTagInt)
|
||||
return new IntTag(key, ((net.minecraft.server.v1_11_R1.NBTTagInt) base).e());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagFloat) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagFloat)
|
||||
return new FloatTag(key, ((net.minecraft.server.v1_11_R1.NBTTagFloat) base).i());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagDouble) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagDouble)
|
||||
return new DoubleTag(key, ((net.minecraft.server.v1_11_R1.NBTTagDouble) base).asDouble());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagLong) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagLong)
|
||||
return new LongTag(key, ((net.minecraft.server.v1_11_R1.NBTTagLong) base).d());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagShort) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagShort)
|
||||
return new ShortTag(key, ((net.minecraft.server.v1_11_R1.NBTTagShort) base).f());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagByte) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagByte)
|
||||
return new ByteTag(key, ((net.minecraft.server.v1_11_R1.NBTTagByte) base).g());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagByteArray) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagByteArray)
|
||||
return new ByteArrayTag(key, ((net.minecraft.server.v1_11_R1.NBTTagByteArray) base).c());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagIntArray) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagIntArray)
|
||||
return new IntArrayTag(key, ((net.minecraft.server.v1_11_R1.NBTTagIntArray) base).d());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagString) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagString)
|
||||
return new StringTag(key, base.toString());
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagList) {
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagList) {
|
||||
List<net.minecraft.server.v1_11_R1.NBTBase> list = (List<net.minecraft.server.v1_11_R1.NBTBase>) base;
|
||||
List<Tag> converted = Lists.newArrayList();
|
||||
if (list.size() > 0) {
|
||||
@ -1689,17 +1672,15 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
return new ListTag(key, tagType, converted);
|
||||
}
|
||||
return null;
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagCompound) {
|
||||
return convertNBT(((net.minecraft.server.v1_11_R1.NBTTagCompound) base));
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagEnd) {
|
||||
} else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagCompound)
|
||||
return convertNBT((net.minecraft.server.v1_11_R1.NBTTagCompound) base);
|
||||
else if (base instanceof net.minecraft.server.v1_11_R1.NBTTagEnd)
|
||||
return new EndTag();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void flyingMoveLogic(EntityLiving entity, float f, float f1) {
|
||||
if ((entity.cu()) || (entity.bA())) {
|
||||
if (entity.cu() || entity.bA()) {
|
||||
if (entity.isInWater()) {
|
||||
double d1 = entity.locY;
|
||||
float f4 = entity instanceof EntityPolarBear ? 0.98F : 0.8F;
|
||||
@ -1723,12 +1704,12 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!entity.isNoGravity()) {
|
||||
entity.motY -= 0.02D;
|
||||
}
|
||||
if ((entity.positionChanged)
|
||||
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ))) {
|
||||
if (entity.positionChanged
|
||||
&& entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ)) {
|
||||
entity.motY = 0.30000001192092896D;
|
||||
}
|
||||
} else if ((entity.ao())
|
||||
&& ((!(entity instanceof EntityHuman)) || (!((EntityHuman) entity).abilities.isFlying))) {
|
||||
} else if (entity.ao()
|
||||
&& (!(entity instanceof EntityHuman) || !((EntityHuman) entity).abilities.isFlying)) {
|
||||
double d1 = entity.locY;
|
||||
entity.a(f, f1, 0.02F);
|
||||
entity.move(EnumMoveType.SELF, entity.motX, entity.motY, entity.motZ);
|
||||
@ -1738,8 +1719,8 @@ public class NMSImpl implements NMSBridge {
|
||||
if (!entity.isNoGravity()) {
|
||||
entity.motY -= 0.02D;
|
||||
}
|
||||
if ((entity.positionChanged)
|
||||
&& (entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ))) {
|
||||
if (entity.positionChanged
|
||||
&& entity.c(entity.motX, entity.motY + 0.6000000238418579D - entity.locY + d1, entity.motZ)) {
|
||||
entity.motY = 0.30000001192092896D;
|
||||
}
|
||||
} else if (entity.cH()) {
|
||||
@ -1754,7 +1735,7 @@ public class NMSImpl implements NMSBridge {
|
||||
float f6 = MathHelper.cos(f5);
|
||||
f6 = (float) (f6 * f6 * Math.min(1.0D, d3 / 0.4D));
|
||||
entity.motY += -0.08D + f6 * 0.06D;
|
||||
if ((entity.motY < 0.0D) && (d0 > 0.0D)) {
|
||||
if (entity.motY < 0.0D && d0 > 0.0D) {
|
||||
double d4 = entity.motY * -0.1D * f6;
|
||||
entity.motY += d4;
|
||||
entity.motX += vec3d.x * d4 / d0;
|
||||
@ -1774,7 +1755,7 @@ public class NMSImpl implements NMSBridge {
|
||||
entity.motY *= 0.9800000190734863D;
|
||||
entity.motZ *= 0.9900000095367432D;
|
||||
entity.move(EnumMoveType.SELF, entity.motX, entity.motY, entity.motZ);
|
||||
if ((entity.positionChanged) && (!entity.world.isClientSide)) {
|
||||
if (entity.positionChanged && !entity.world.isClientSide) {
|
||||
double d4 = Math.sqrt(entity.motX * entity.motX + entity.motZ * entity.motZ);
|
||||
double d5 = d2 - d4;
|
||||
float f7 = (float) (d5 * 10.0D - 3.0D);
|
||||
@ -1783,8 +1764,8 @@ public class NMSImpl implements NMSBridge {
|
||||
entity.damageEntity(DamageSource.FLY_INTO_WALL, f7);
|
||||
}
|
||||
}
|
||||
if ((entity.onGround) && (!entity.world.isClientSide) && (entity.getFlag(7))
|
||||
&& (!CraftEventFactory.callToggleGlideEvent(entity, false).isCancelled())) {
|
||||
if (entity.onGround && !entity.world.isClientSide && entity.getFlag(7)
|
||||
&& !CraftEventFactory.callToggleGlideEvent(entity, false).isCancelled()) {
|
||||
entity.setFlag(7, false);
|
||||
}
|
||||
} else {
|
||||
@ -1814,13 +1795,13 @@ public class NMSImpl implements NMSBridge {
|
||||
if (entity.motY < -0.15D) {
|
||||
entity.motY = -0.15D;
|
||||
}
|
||||
boolean flag = (entity.isSneaking()) && ((entity instanceof EntityHuman));
|
||||
if ((flag) && (entity.motY < 0.0D)) {
|
||||
boolean flag = entity.isSneaking() && entity instanceof EntityHuman;
|
||||
if (flag && entity.motY < 0.0D) {
|
||||
entity.motY = 0.0D;
|
||||
}
|
||||
}
|
||||
entity.move(EnumMoveType.SELF, entity.motX, entity.motY, entity.motZ);
|
||||
if ((entity.positionChanged) && (entity.m_())) {
|
||||
if (entity.positionChanged && entity.m_()) {
|
||||
entity.motY = 0.2D;
|
||||
}
|
||||
if (entity.hasEffect(MobEffects.LEVITATION)) {
|
||||
@ -1828,8 +1809,8 @@ public class NMSImpl implements NMSBridge {
|
||||
* 0.2D;
|
||||
} else {
|
||||
blockposition_pooledblockposition.e(entity.locX, 0.0D, entity.locZ);
|
||||
if ((entity.world.isClientSide) && ((!entity.world.isLoaded(blockposition_pooledblockposition))
|
||||
|| (!entity.world.getChunkAtWorldCoords(blockposition_pooledblockposition).p()))) {
|
||||
if (entity.world.isClientSide && (!entity.world.isLoaded(blockposition_pooledblockposition)
|
||||
|| !entity.world.getChunkAtWorldCoords(blockposition_pooledblockposition).p())) {
|
||||
if (entity.locY > 0.0D) {
|
||||
entity.motY = -0.1D;
|
||||
} else {
|
||||
@ -1939,7 +1920,7 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
public static void sendPacketNearby(Player from, Location location, Packet<?> packet, double radius) {
|
||||
List<Packet<?>> list = new ArrayList<Packet<?>>();
|
||||
List<Packet<?>> list = new ArrayList<>();
|
||||
list.add(packet);
|
||||
sendPacketsNearby(from, location, list, radius);
|
||||
}
|
||||
@ -1948,8 +1929,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) {
|
||||
@ -1971,15 +1952,16 @@ public class NMSImpl implements NMSBridge {
|
||||
}
|
||||
|
||||
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
|
||||
if ((f != entity.width) || (f1 != entity.length)) {
|
||||
if (f != entity.width || f1 != entity.length) {
|
||||
float f2 = entity.width;
|
||||
entity.width = f;
|
||||
entity.length = f1;
|
||||
entity.a(new AxisAlignedBB(entity.getBoundingBox().a, entity.getBoundingBox().b, entity.getBoundingBox().c,
|
||||
entity.getBoundingBox().a + entity.width, entity.getBoundingBox().b + entity.length,
|
||||
entity.getBoundingBox().c + entity.width));
|
||||
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
|
||||
if (entity.width > f2 && !justCreated && !entity.world.isClientSide) {
|
||||
entity.move(EnumMoveType.SELF, (f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user