Java 类org.bukkit.event.entity.EntityUnleashEvent 实例源码
项目:Cauldron
文件:EntityLiving.java
protected void updateLeashedState()
{
if (this.field_110170_bx != null)
{
this.recreateLeash();
}
if (this.isLeashed)
{
if (this.leashedToEntity == null || this.leashedToEntity.isDead)
{
this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
this.clearLeashed(true, true);
}
}
}
项目:SpigotSource
文件:EntityInsentient.java
protected void cP() {
if (this.bF != null) {
this.cU();
}
if (this.bD) {
if (!this.isAlive()) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.PLAYER_UNLEASH)); // CraftBukkit
this.unleash(true, true);
}
if (this.leashHolder == null || this.leashHolder.dead) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
this.unleash(true, true);
}
}
}
项目:Skellett
文件:ExprUnleashHitch.java
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
if (!ScriptLoader.isCurrentEvent(EntityUnleashEvent.class)) {
Skript.error("You can not use UnleashHitch expression in any event but on entity unleash!");
return false;
}
setTime(1);
return true;
}
项目:Skellett
文件:ExprUnleashHitch.java
@Nullable
protected Entity[] get(Event e) {
try {
return new Entity[]{((LivingEntity) ((EntityUnleashEvent)e).getEntity()).getLeashHolder()};
} catch (IllegalStateException error) {}
return null;
}
项目:Skellett
文件:ExprUnleashReason.java
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
if (!ScriptLoader.isCurrentEvent(EntityUnleashEvent.class)) {
Skript.error("You can not use UnleashReason expression in any event but on entity unleash!");
return false;
}
return true;
}
项目:CraftBukkit
文件:EntityInsentient.java
protected void bL() {
if (this.bx != null) {
this.bP();
}
if (this.bv) {
if (this.bw == null || this.bw.dead) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
this.unleash(true, true);
}
}
}
项目:CraftBukkit
文件:EntityInsentient.java
private void bP() {
if (this.bv && this.bx != null) {
if (this.bx.hasKeyOfType("UUIDMost", 4) && this.bx.hasKeyOfType("UUIDLeast", 4)) {
UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast"));
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving.getUniqueID().equals(uuid)) {
this.bw = entityliving;
break;
}
}
} else if (this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) {
int i = this.bx.getInt("X");
int j = this.bx.getInt("Y");
int k = this.bx.getInt("Z");
EntityLeash entityleash = EntityLeash.b(this.world, i, j, k);
if (entityleash == null) {
entityleash = EntityLeash.a(this.world, i, j, k);
}
this.bw = entityleash;
} else {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(false, true);
}
}
this.bx = null;
}
项目:Almura-Server
文件:EntityInsentient.java
protected void bF() {
if (this.bx != null) {
this.bJ();
}
if (this.bv) {
if (this.bw == null || this.bw.dead) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
this.unleash(true, true);
}
}
}
项目:Almura-Server
文件:EntityInsentient.java
private void bJ() {
if (this.bv && this.bx != null) {
if (this.bx.hasKey("UUIDMost") && this.bx.hasKey("UUIDLeast")) {
UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast"));
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving.getUniqueID().equals(uuid)) {
this.bw = entityliving;
break;
}
}
} else if (this.bx.hasKey("X") && this.bx.hasKey("Y") && this.bx.hasKey("Z")) {
int i = this.bx.getInt("X");
int j = this.bx.getInt("Y");
int k = this.bx.getInt("Z");
EntityLeash entityleash = EntityLeash.b(this.world, i, j, k);
if (entityleash == null) {
entityleash = EntityLeash.a(this.world, i, j, k);
}
this.bw = entityleash;
} else {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(false, true);
}
}
this.bx = null;
}
项目:Tweakkit-Server
文件:EntityInsentient.java
protected void bL() {
if (this.bx != null) {
this.bP();
}
if (this.bv) {
if (this.bw == null || this.bw.dead) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.HOLDER_GONE)); // CraftBukkit
this.unleash(true, true);
}
}
}
项目:Tweakkit-Server
文件:EntityInsentient.java
private void bP() {
if (this.bv && this.bx != null) {
if (this.bx.hasKeyOfType("UUIDMost", 4) && this.bx.hasKeyOfType("UUIDLeast", 4)) {
UUID uuid = new UUID(this.bx.getLong("UUIDMost"), this.bx.getLong("UUIDLeast"));
List list = this.world.a(EntityLiving.class, this.boundingBox.grow(10.0D, 10.0D, 10.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving.getUniqueID().equals(uuid)) {
this.bw = entityliving;
break;
}
}
} else if (this.bx.hasKeyOfType("X", 99) && this.bx.hasKeyOfType("Y", 99) && this.bx.hasKeyOfType("Z", 99)) {
int i = this.bx.getInt("X");
int j = this.bx.getInt("Y");
int k = this.bx.getInt("Z");
EntityLeash entityleash = EntityLeash.b(this.world, i, j, k);
if (entityleash == null) {
entityleash = EntityLeash.a(this.world, i, j, k);
}
this.bw = entityleash;
} else {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(false, true);
}
}
this.bx = null;
}
项目:SpigotSource
文件:EntityInsentient.java
private void cU() {
if (this.bD && this.bF != null) {
if (this.bF.b("UUID")) {
UUID uuid = this.bF.a("UUID");
List list = this.world.a(EntityLiving.class, this.getBoundingBox().g(10.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext()) {
EntityLiving entityliving = (EntityLiving) iterator.next();
if (entityliving.getUniqueID().equals(uuid)) {
this.leashHolder = entityliving;
break;
}
}
} else if (this.bF.hasKeyOfType("X", 99) && this.bF.hasKeyOfType("Y", 99) && this.bF.hasKeyOfType("Z", 99)) {
BlockPosition blockposition = new BlockPosition(this.bF.getInt("X"), this.bF.getInt("Y"), this.bF.getInt("Z"));
EntityLeash entityleash = EntityLeash.b(this.world, blockposition);
if (entityleash == null) {
entityleash = EntityLeash.a(this.world, blockposition);
}
this.leashHolder = entityleash;
} else {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.unleash(false, true);
}
}
this.bF = null;
}
项目:Skellett
文件:ExprUnleashReason.java
public Class<? extends EntityUnleashEvent.UnleashReason> getReturnType() {
return EntityUnleashEvent.UnleashReason.class;
}
项目:Skellett
文件:ExprUnleashReason.java
@Nullable
protected EntityUnleashEvent.UnleashReason[] get(Event e) {
return new EntityUnleashEvent.UnleashReason[]{((EntityUnleashEvent)e).getReason()};
}
项目:CraftBukkit
文件:EntityCreature.java
protected void bL() {
super.bL();
if (this.bN() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
this.a((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
float f = this.e(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
return;
}
if (!this.bt) {
this.goalSelector.a(2, this.bs);
this.getNavigation().a(false);
this.bt = true;
}
this.o(f);
if (f > 4.0F) {
this.getNavigation().a(entity, 1.0D);
}
if (f > 6.0F) {
double d0 = (entity.locX - this.locX) / (double) f;
double d1 = (entity.locY - this.locY) / (double) f;
double d2 = (entity.locZ - this.locZ) / (double) f;
this.motX += d0 * Math.abs(d0) * 0.4D;
this.motY += d1 * Math.abs(d1) * 0.4D;
this.motZ += d2 * Math.abs(d2) * 0.4D;
}
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
} else if (!this.bN() && this.bt) {
this.bt = false;
this.goalSelector.a(this.bs);
this.getNavigation().a(true);
this.bX();
}
}
项目:Almura-Server
文件:EntityCreature.java
protected void bF() {
super.bF();
if (this.bH() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
this.b((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
float f = this.d(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
return;
}
if (!this.bt) {
this.goalSelector.a(2, this.bs);
this.getNavigation().a(false);
this.bt = true;
}
this.o(f);
if (f > 4.0F) {
this.getNavigation().a(entity, 1.0D);
}
if (f > 6.0F) {
double d0 = (entity.locX - this.locX) / (double) f;
double d1 = (entity.locY - this.locY) / (double) f;
double d2 = (entity.locZ - this.locZ) / (double) f;
this.motX += d0 * Math.abs(d0) * 0.4D;
this.motY += d1 * Math.abs(d1) * 0.4D;
this.motZ += d2 * Math.abs(d2) * 0.4D;
}
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
} else if (!this.bH() && this.bt) {
this.bt = false;
this.goalSelector.a(this.bs);
this.getNavigation().a(true);
this.bR();
}
}
项目:Tweakkit-Server
文件:EntityCreature.java
protected void bL() {
super.bL();
if (this.bN() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
this.a((int) entity.locX, (int) entity.locY, (int) entity.locZ, 5);
float f = this.e(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
return;
}
if (!this.bt) {
this.goalSelector.a(2, this.bs);
this.getNavigation().a(false);
this.bt = true;
}
this.o(f);
if (f > 4.0F) {
this.getNavigation().a(entity, 1.0D);
}
if (f > 6.0F) {
double d0 = (entity.locX - this.locX) / (double) f;
double d1 = (entity.locY - this.locY) / (double) f;
double d2 = (entity.locZ - this.locZ) / (double) f;
this.motX += d0 * Math.abs(d0) * 0.4D;
this.motY += d1 * Math.abs(d1) * 0.4D;
this.motZ += d2 * Math.abs(d2) * 0.4D;
}
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
} else if (!this.bN() && this.bt) {
this.bt = false;
this.goalSelector.a(this.bs);
this.getNavigation().a(true);
this.bX();
}
}
项目:Cauldron
文件:EntityLiving.java
private void recreateLeash()
{
if (this.isLeashed && this.field_110170_bx != null)
{
if (this.field_110170_bx.hasKey("UUIDMost", 4) && this.field_110170_bx.hasKey("UUIDLeast", 4))
{
UUID uuid = new UUID(this.field_110170_bx.getLong("UUIDMost"), this.field_110170_bx.getLong("UUIDLeast"));
List list = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, this.boundingBox.expand(10.0D, 10.0D, 10.0D));
Iterator iterator = list.iterator();
while (iterator.hasNext())
{
EntityLivingBase entitylivingbase = (EntityLivingBase)iterator.next();
if (entitylivingbase.getUniqueID().equals(uuid))
{
this.leashedToEntity = entitylivingbase;
break;
}
}
}
else if (this.field_110170_bx.hasKey("X", 99) && this.field_110170_bx.hasKey("Y", 99) && this.field_110170_bx.hasKey("Z", 99))
{
int i = this.field_110170_bx.getInteger("X");
int j = this.field_110170_bx.getInteger("Y");
int k = this.field_110170_bx.getInteger("Z");
EntityLeashKnot entityleashknot = EntityLeashKnot.getKnotForBlock(this.worldObj, i, j, k);
if (entityleashknot == null)
{
entityleashknot = EntityLeashKnot.func_110129_a(this.worldObj, i, j, k);
}
this.leashedToEntity = entityleashknot;
}
else
{
this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit
this.clearLeashed(false, true);
}
}
this.field_110170_bx = null;
}
项目:Cauldron
文件:EntityCreature.java
protected void updateLeashedState()
{
super.updateLeashedState();
if (this.getLeashed() && this.getLeashedToEntity() != null && this.getLeashedToEntity().worldObj == this.worldObj)
{
Entity entity = this.getLeashedToEntity();
this.setHomeArea((int)entity.posX, (int)entity.posY, (int)entity.posZ, 5);
float f = this.getDistanceToEntity(entity);
if (this instanceof EntityTameable && ((EntityTameable)this).isSitting())
{
if (f > 10.0F)
{
this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.clearLeashed(true, true);
}
return;
}
if (!this.field_110180_bt)
{
this.tasks.addTask(2, this.field_110178_bs);
this.getNavigator().setAvoidsWater(false);
this.field_110180_bt = true;
}
this.func_142017_o(f);
if (f > 4.0F)
{
this.getNavigator().tryMoveToEntityLiving(entity, 1.0D);
}
if (f > 6.0F)
{
double d0 = (entity.posX - this.posX) / (double)f;
double d1 = (entity.posY - this.posY) / (double)f;
double d2 = (entity.posZ - this.posZ) / (double)f;
this.motionX += d0 * Math.abs(d0) * 0.4D;
this.motionY += d1 * Math.abs(d1) * 0.4D;
this.motionZ += d2 * Math.abs(d2) * 0.4D;
}
if (f > 10.0F)
{
this.worldObj.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.clearLeashed(true, true);
}
}
else if (!this.getLeashed() && this.field_110180_bt)
{
this.field_110180_bt = false;
this.tasks.removeTask(this.field_110178_bs);
this.getNavigator().setAvoidsWater(true);
this.detachHome();
}
}
项目:Pore
文件:PoreEntityUnleashEvent.java
public PoreEntityUnleashEvent(org.spongepowered.api.event.entity.EntityUnleashEvent handle) {
super(null, null);
this.handle = checkNotNull(handle, "handle");
}
项目:Pore
文件:PoreEntityUnleashEvent.java
public org.spongepowered.api.event.entity.EntityUnleashEvent getHandle() {
return this.handle;
}
项目:BedrockAPI
文件:EntityUnleashEvent.java
public EntityUnleashEvent(Entity entity, EntityUnleashEvent.UnleashReason reason) {
}
项目:BedrockAPI
文件:EntityUnleashEvent.java
public EntityUnleashEvent.UnleashReason getReason() {
return null;
}
项目:SpigotSource
文件:EntityCreature.java
protected void cP() {
super.cP();
if (this.isLeashed() && this.getLeashHolder() != null && this.getLeashHolder().world == this.world) {
Entity entity = this.getLeashHolder();
this.a(new BlockPosition((int) entity.locX, (int) entity.locY, (int) entity.locZ), 5);
float f = this.g(entity);
if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) {
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
return;
}
if (!this.bw) {
this.goalSelector.a(2, this.c);
if (this.getNavigation() instanceof Navigation) {
this.bx = this.a(PathType.WATER);
this.a(PathType.WATER, 0.0F);
}
this.bw = true;
}
this.q(f);
if (f > 4.0F) {
this.getNavigation().a(entity, 1.0D);
}
if (f > 6.0F) {
double d0 = (entity.locX - this.locX) / (double) f;
double d1 = (entity.locY - this.locY) / (double) f;
double d2 = (entity.locZ - this.locZ) / (double) f;
this.motX += d0 * Math.abs(d0) * 0.4D;
this.motY += d1 * Math.abs(d1) * 0.4D;
this.motZ += d2 * Math.abs(d2) * 0.4D;
}
if (f > 10.0F) {
this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit
this.unleash(true, true);
}
} else if (!this.isLeashed() && this.bw) {
this.bw = false;
this.goalSelector.a(this.c);
if (this.getNavigation() instanceof Navigation) {
this.a(PathType.WATER, this.bx);
}
this.cY();
}
}