当前位置: 首页>>代码示例>>Java>>正文


Java CraftEntity类代码示例

本文整理汇总了Java中org.bukkit.craftbukkit.entity.CraftEntity的典型用法代码示例。如果您正苦于以下问题:Java CraftEntity类的具体用法?Java CraftEntity怎么用?Java CraftEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CraftEntity类属于org.bukkit.craftbukkit.entity包,在下文中一共展示了CraftEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: _INVALID_getShooter

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
@Override
public LivingEntity _INVALID_getShooter() {
    if (shooter instanceof LivingEntity) { return (LivingEntity)shooter; }
    if (shooter instanceof BlockProjectileSource)
    {
        Block block = ((BlockProjectileSource)shooter).getBlock();
        if(!(block.getWorld() instanceof WorldServer))return null;
        int x = block.getX(), y = block.getY(), z = block.getZ();
        WorldServer ws = (WorldServer)block.getWorld();
        EntityPlayerMP fake_dropper = new EntityPlayerMP(MinecraftServer.getServer(), ws, dropper, new ItemInWorldManager(MinecraftServer.getServer().worldServerForDimension(0)));
        fake_dropper.posX = x; fake_dropper.posY = y; fake_dropper.posZ = z;
        CraftEntity ce = org.bukkit.craftbukkit.entity.CraftEntity.getEntity(MinecraftServer.getServer().server, fake_dropper);
        if(ce instanceof LivingEntity) return (LivingEntity)ce;
        return null;
    } return null;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos,代码行数:17,代码来源:CustomProjectileEntity.java

示例2: evaluate

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
@Override
public FilterState evaluate(final Object... objects) {
    boolean abstain = true;
    for (Object object : objects) {
        if (object instanceof Entity) {
            if (((CraftEntity)object).getHandle() instanceof EntityInsentient) {
                return allow ? FilterState.ALLOW : FilterState.DENY;
            }
            abstain = false;
        }
    }
    if (abstain) {
        return (getParent() == null ? ABSTAIN : getParent().evaluate(objects));
    }
    return allow ? FilterState.DENY : FilterState.ALLOW;
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:17,代码来源:AllMobFilter.java

示例3: p

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
protected void p(Entity entity) {
    if (entity.bz() == this) {
        throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)");
    } else {
        // CraftBukkit start
        CraftEntity craft = (CraftEntity) entity.getBukkitEntity().getVehicle();
        Entity orig = craft == null ? null : craft.getHandle();
        if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) {
            VehicleExitEvent event = new VehicleExitEvent(
                    (Vehicle) getBukkitEntity(),
                    (LivingEntity) entity.getBukkitEntity()
            );
            Bukkit.getPluginManager().callEvent(event);
            CraftEntity craftn = (CraftEntity) entity.getBukkitEntity().getVehicle();
            Entity n = craftn == null ? null : craftn.getHandle();
            if (event.isCancelled() || n != orig) {
                return;
            }
        }
        // CraftBukkit end
        Bukkit.getPluginManager().callEvent( new org.spigotmc.event.entity.EntityDismountEvent(entity.getBukkitEntity(), this.getBukkitEntity())); // Spigot
        this.passengers.remove(entity);
        entity.j = 60;
    }
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:26,代码来源:Entity.java

示例4: getTranslationKey

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
public static String getTranslationKey(Entity entity) {
    if(entity instanceof TNTPrimed) {
        return "tile.tnt.name";
    } else if(entity instanceof Egg) {
        return "item.egg.name";
    } else {
        final String id = EntityTypes.b(((CraftEntity) entity).getHandle());
        return "entity." + (id != null ? id : "generic") + ".name";
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:11,代码来源:NMSHacks.java

示例5: callSpawnerSpawnEvent

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
/**
 * Mob spawner event
 */
public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, int spawnerX, int spawnerY, int spawnerZ) {
    org.bukkit.craftbukkit.entity.CraftEntity entity = spawnee.getBukkitEntity();
    BlockState state = entity.getWorld().getBlockAt(spawnerX, spawnerY, spawnerZ).getState();

    if (!(state instanceof CreatureSpawner)) {
        state = null;
    }

    SpawnerSpawnEvent event = new SpawnerSpawnEvent(entity, (CreatureSpawner) state);
    entity.getServer().getPluginManager().callEvent(event);
    return event;
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:16,代码来源:CraftEventFactory.java

示例6: getBukkitEntity

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
public CraftEntity getBukkitEntity()
{
    if (this.bukkitEntity == null)
    {
        this.bukkitEntity = CraftEntity.getEntity(this.worldObj.getServer(), this);
    }

    return this.bukkitEntity;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:10,代码来源:Entity.java

示例7: evaluate

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
@Override
public FilterState evaluate(Object... objects) {
    for (Object object : objects) {
        if (object instanceof Entity) {
            if (((CraftEntity)object).getHandle() instanceof EntityInsentient && mobType.equals(((CraftEntity) object).getType()))
                return ALLOW;
            else
                return DENY;
        }
    }
    return (getParent() == null ? ABSTAIN : getParent().evaluate(objects));
}
 
开发者ID:twizmwazin,项目名称:CardinalPGM,代码行数:13,代码来源:MobFilter.java

示例8: callSpawnerSpawnEvent

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
/**
 * Mob spawner event.
 */
public static SpawnerSpawnEvent callSpawnerSpawnEvent(Entity spawnee, BlockPosition pos) {
    org.bukkit.craftbukkit.entity.CraftEntity entity = spawnee.getBukkitEntity();
    BlockState state = entity.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()).getState();
    if (!(state instanceof org.bukkit.block.CreatureSpawner)) {
        state = null;
    }

    SpawnerSpawnEvent event = new SpawnerSpawnEvent(entity, (org.bukkit.block.CreatureSpawner) state);
    entity.getServer().getPluginManager().callEvent(event);
    return event;
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:15,代码来源:CraftEventFactory.java

示例9: getTrackerEntry

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
private static EntityTrackerEntry getTrackerEntry(Entity entity) {
    return getTrackerEntry(((CraftEntity) entity).getHandle());
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:NMSHacks.java

示例10: copyEntityMetadata

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
private static List<DataWatcher.Item<?>> copyEntityMetadata(Entity entity) {
    final List<DataWatcher.Item<?>> metadata = ((CraftEntity) entity).getHandle().getDataWatcher().c();
    DataWatcher.deepCopy(metadata);
    return metadata;
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:6,代码来源:NMSHacks.java

示例11: entityMetadataPacket

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
public static Packet entityMetadataPacket(int entityId, Entity entity, boolean complete) {
    return entityMetadataPacket(entityId, ((CraftEntity) entity).getHandle(), complete);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:NMSHacks.java

示例12: createExplosion

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
public static void createExplosion(Entity entity, Location loc, float power, boolean fire, boolean destroy) {
    ((CraftWorld) loc.getWorld()).getHandle().createExplosion(((CraftEntity) entity).getHandle(), loc.getX(), loc.getY(), loc.getZ(), power, fire, destroy);
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:NMSHacks.java

示例13: getBukkitEntity

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
public CraftEntity getBukkitEntity() {
    if (this.bukkitEntity == null) {
        this.bukkitEntity = CraftEntity.getEntity(this.world.getServer(), this);
    }
    return this.bukkitEntity;
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:7,代码来源:Entity.java

示例14: bq

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
protected void bq() {
    this.w();
    // CraftBukkit start
    Entity entityhuman = this.world.findNearbyVulnerablePlayer(this, 16.0D); // EntityHuman -> Entity
    EntityTargetEvent event = null;

    if (entityhuman != null && !entityhuman.equals(lastTarget)) {
        event = CraftEventFactory.callEntityTargetEvent(this, entityhuman, EntityTargetEvent.TargetReason.CLOSEST_PLAYER);
    } else if (lastTarget != null && entityhuman == null) {
        event = CraftEventFactory.callEntityTargetEvent(this, entityhuman, EntityTargetEvent.TargetReason.FORGOT_TARGET);
    }

    if (event != null && !event.isCancelled()) {
        entityhuman = event.getTarget() == null ? null : ((CraftEntity) event.getTarget()).getHandle();
    }

    this.lastTarget = entityhuman;
    // CraftBukkit end

    if (entityhuman != null) {
        this.a(entityhuman, 10.0F, 20.0F);
    }

    if (this.onGround && this.jumpDelay-- <= 0) {
        this.jumpDelay = this.bR();
        if (entityhuman != null) {
            this.jumpDelay /= 3;
        }

        this.bc = true;
        if (this.bY()) {
            this.makeSound(this.bV(), this.bf(), ((this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F) * 0.8F);
        }

        this.bd = 1.0F - this.random.nextFloat() * 2.0F;
        this.be = (float) (1 * this.getSize());
    } else {
        this.bc = false;
        if (this.onGround) {
            this.bd = this.be = 0.0F;
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:44,代码来源:EntitySlime.java

示例15: a

import org.bukkit.craftbukkit.entity.CraftEntity; //导入依赖的package包/类
protected boolean a(EntityLiving entityliving, boolean flag) {
    if (entityliving == null) {
        return false;
    } else if (entityliving == this.c) {
        return false;
    } else if (!entityliving.isAlive()) {
        return false;
    } else if (!this.c.a(entityliving.getClass())) {
        return false;
    } else {
        if (this.c instanceof EntityOwnable && StringUtils.isNotEmpty(((EntityOwnable) this.c).getOwnerUUID())) {
            if (entityliving instanceof EntityOwnable && ((EntityOwnable) this.c).getOwnerUUID().equals(((EntityOwnable) entityliving).getOwnerUUID())) {
                return false;
            }

            if (entityliving == ((EntityOwnable) this.c).getOwner()) {
                return false;
            }
        } else if (entityliving instanceof EntityHuman && !flag && ((EntityHuman) entityliving).abilities.isInvulnerable) {
            return false;
        }

        if (!this.c.b(MathHelper.floor(entityliving.locX), MathHelper.floor(entityliving.locY), MathHelper.floor(entityliving.locZ))) {
            return false;
        } else if (this.d && !this.c.getEntitySenses().canSee(entityliving)) {
            return false;
        } else {
            if (this.a) {
                if (--this.e <= 0) {
                    this.b = 0;
                }

                if (this.b == 0) {
                    this.b = this.a(entityliving) ? 1 : 2;
                }

                if (this.b == 2) {
                    return false;
                }
            }

            // CraftBukkit start - Check all the different target goals for the reason, default to RANDOM_TARGET
            EntityTargetEvent.TargetReason reason = EntityTargetEvent.TargetReason.RANDOM_TARGET;

            if (this instanceof PathfinderGoalDefendVillage) {
                reason = EntityTargetEvent.TargetReason.DEFEND_VILLAGE;
            } else if (this instanceof PathfinderGoalHurtByTarget) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_ENTITY;
            } else if (this instanceof PathfinderGoalNearestAttackableTarget) {
                if (entityliving instanceof EntityHuman) {
                    reason = EntityTargetEvent.TargetReason.CLOSEST_PLAYER;
                }
            } else if (this instanceof PathfinderGoalOwnerHurtByTarget) {
                reason = EntityTargetEvent.TargetReason.TARGET_ATTACKED_OWNER;
            } else if (this instanceof PathfinderGoalOwnerHurtTarget) {
                reason = EntityTargetEvent.TargetReason.OWNER_ATTACKED_TARGET;
            }

            org.bukkit.event.entity.EntityTargetLivingEntityEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTargetLivingEvent(this.c, entityliving, reason);
            if (event.isCancelled() || event.getTarget() == null) {
                this.c.setGoalTarget(null);
                return false;
            } else if (entityliving.getBukkitEntity() != event.getTarget()) {
                this.c.setGoalTarget((EntityLiving) ((CraftEntity) event.getTarget()).getHandle());
            }
            if (this.c instanceof EntityCreature) {
                ((EntityCreature) this.c).target = ((CraftEntity) event.getTarget()).getHandle();
            }
            // CraftBukkit end

            return true;
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:CraftBukkit,代码行数:75,代码来源:PathfinderGoalTarget.java


注:本文中的org.bukkit.craftbukkit.entity.CraftEntity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。