Java 类net.minecraft.entity.item.EntityTNTPrimed 实例源码

项目:Annointment    文件:EasterEggCommand.java   
private static boolean triggerExplosion(World world, int x, int baseY,
        int z, Cause cause) {
    int y = baseY + EXPLOSION_Y_OFFSET;
    Optional<Entity> opt = world.createEntity(EntityTypes.PRIMED_TNT,
            new Vector3i(x, y, z));
    if (!opt.isPresent()) {
        APlugin.getInstance().getLogger().info("Couldn't spawn PTNT at "
                + String.format("(%s, %s, %s)", x, y, z));
        return false;
    }
    Entity e = opt.get();
    ((EntityTNTPrimed) e).fuse = EXPLOSION_TIMER;
    // if (!e.offer(Keys.FUSE_DURATION, EXPLOSION_TIMER).isSuccessful()) {
    // APlugin.getInstance().getLogger().info("Couldn't set data on " + e);
    // return false;
    // }
    return world.spawnEntity(e, cause);
}
项目:Factorization    文件:BlowEntities.java   
@Override
public boolean apply(Entity entity) {
    if (entity instanceof EntityItem) {
        return true;
    }
    if (target_speed <= 1) {
        return false;
    }
    if (entity instanceof EntityLiving || entity instanceof IProjectile || entity instanceof EntityTNTPrimed || entity instanceof EntityFallingBlock) {
        return true;
    }
    if (FzConfig.fanturpeller_works_on_players && entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        found_player = true;
        return !player.capabilities.isCreativeMode && !player.isSneaking();
    }
    return false;
    // Falling sand doesn't work too well with this
    // Minecarts seem to just jump back down (and would be too heavy anyways.)
    // Let's try to keep this method light, hmm?
}
项目:Annointment    文件:EasterEggCommand.java   
private static boolean triggerExplosion(World world, int x, int baseY,
        int z, Cause cause) {
    int y = baseY + EXPLOSION_Y_OFFSET;
    Optional<Entity> opt = world.createEntity(EntityTypes.PRIMED_TNT,
            new Vector3i(x, y, z));
    if (!opt.isPresent()) {
        APlugin.getInstance().getLogger().info("Couldn't spawn PTNT at "
                + String.format("(%s, %s, %s)", x, y, z));
        return false;
    }
    Entity e = opt.get();
    ((EntityTNTPrimed) e).fuse = EXPLOSION_TIMER;
    // if (!e.offer(Keys.FUSE_DURATION, EXPLOSION_TIMER).isSuccessful()) {
    // APlugin.getInstance().getLogger().info("Couldn't set data on " + e);
    // return false;
    // }
    return world.spawnEntity(e, cause);
}
项目:morecommands    文件:CommandDefuse.java   
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
    double radius = 16;

    if (params.length > 0) {
        try {radius = Double.parseDouble(params[0]);}
        catch (NumberFormatException nfe) {throw new CommandException("command.defuse.invalidArg", sender);}
    }

    World world = sender.getWorld();
    BlockPos pos = sender.getPosition();

    Iterator<EntityTNTPrimed> tntPrimedIterator = world.getEntitiesWithinAABB(EntityTNTPrimed.class, new AxisAlignedBB(pos.getX() - radius, pos.getY() - radius, pos.getZ() - radius, pos.getX() + radius, pos.getY() + radius, pos.getZ() + radius)).iterator();

    while (tntPrimedIterator.hasNext()) {
        Entity tntPrimed = tntPrimedIterator.next();
        tntPrimed.setDead();

        EntityItem tnt = new EntityItem(world, tntPrimed.posX, tntPrimed.posY, tntPrimed.posZ, new ItemStack(Item.getItemFromBlock(Blocks.TNT), 1));
        world.spawnEntity(tnt);
    }

    sender.sendLangfileMessage("command.defuse.defused");
    return null;
}
项目:Rediscovered-Mod-1.8.8    文件:EntityRana.java   
public EntityRana(World par1World, int par2)
{
    super(par1World);
    randomTickDivider = 0;
    isPlayingFlag = false;
    villageObj = null;
    setProfession(par2);
    dead = false;
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    tasks.addTask(0, new EntityAISwimming(this));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityZombie.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntitySkeleton.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntitySpider.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityTNTPrimed.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityCreeper.class, 8.0F, 0.6D, 0.6D));
    tasks.addTask(5, new EntityAIMoveIndoors(this));
    tasks.addTask(6, new EntityAIRestrictOpenDoor(this));
    tasks.addTask(7, new EntityAIOpenDoor(this, true));
    tasks.addTask(8, new EntityAIMoveTowardsRestriction(this, 0.3F));
    tasks.addTask(9, new EntityAIWatchClosest2(this, net.minecraft.entity.player.EntityPlayer.class, 3F, 1.0F));
    tasks.addTask(10, new EntityAIWatchClosest2(this, net.minecraft.entity.passive.EntityVillager.class, 5F, 0.02F));
    tasks.addTask(11, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityRana.class, 5F, 0.02F));
    tasks.addTask(12, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntitySteve.class, 5F, 0.02F));
    tasks.addTask(13, new EntityAIWander(this, 0.3F));
    tasks.addTask(14, new EntityAIWatchClosest(this, net.minecraft.entity.EntityLiving.class, 8F));
}
项目:pnc-repressurized    文件:HackableTNT.java   
@Override
public void onHackFinished(World world, BlockPos pos, EntityPlayer player) {
    if (!world.isRemote) {
        world.setBlockToAir(pos);
        EntityTNTPrimed tnt = new EntityTNTPrimed(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, player);
        tnt.setFuse(1);
        world.spawnEntity(tnt);
    }
}
项目:Uranium    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:DecompiledMinecraft    文件:BlockTNT.java   
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}
项目:DecompiledMinecraft    文件:BlockTNT.java   
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
{
    if (!worldIn.isRemote)
    {
        if (((Boolean)state.getValue(EXPLODE)).booleanValue())
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);
            worldIn.spawnEntityInWorld(entitytntprimed);
            worldIn.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
        }
    }
}
项目:DecompiledMinecraft    文件:BlockTNT.java   
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}
项目:DecompiledMinecraft    文件:BlockTNT.java   
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
{
    if (!worldIn.isRemote)
    {
        if (((Boolean)state.getValue(EXPLODE)).booleanValue())
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);
            worldIn.spawnEntityInWorld(entitytntprimed);
            worldIn.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
        }
    }
}
项目:BaseClient    文件:BlockTNT.java   
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}
项目:BaseClient    文件:BlockTNT.java   
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
{
    if (!worldIn.isRemote)
    {
        if (((Boolean)state.getValue(EXPLODE)).booleanValue())
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);
            worldIn.spawnEntityInWorld(entitytntprimed);
            worldIn.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
        }
    }
}
项目:BaseClient    文件:BlockTNT.java   
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.fuse = worldIn.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}
项目:BaseClient    文件:BlockTNT.java   
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
{
    if (!worldIn.isRemote)
    {
        if (((Boolean)state.getValue(EXPLODE)).booleanValue())
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);
            worldIn.spawnEntityInWorld(entitytntprimed);
            worldIn.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
        }
    }
}
项目:Backmemed    文件:Explosion.java   
@Nullable

    /**
     * Returns either the entity that placed the explosive block, the entity that caused the explosion or null.
     */
    public EntityLivingBase getExplosivePlacedBy()
    {
        return this.exploder == null ? null : (this.exploder instanceof EntityTNTPrimed ? ((EntityTNTPrimed)this.exploder).getTntPlacedBy() : (this.exploder instanceof EntityLivingBase ? (EntityLivingBase)this.exploder : null));
    }
项目:Backmemed    文件:BlockTNT.java   
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.setFuse((short)(worldIn.rand.nextInt(entitytntprimed.getFuse() / 4) + entitytntprimed.getFuse() / 8));
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}
项目:Backmemed    文件:BlockTNT.java   
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
{
    if (!worldIn.isRemote)
    {
        if (((Boolean)state.getValue(EXPLODE)).booleanValue())
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);
            worldIn.spawnEntityInWorld(entitytntprimed);
            worldIn.playSound((EntityPlayer)null, entitytntprimed.posX, entitytntprimed.posY, entitytntprimed.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
        }
    }
}
项目:CustomWorldGen    文件:BlockTNT.java   
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.setFuse((short)(worldIn.rand.nextInt(entitytntprimed.getFuse() / 4) + entitytntprimed.getFuse() / 8));
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}
项目:CustomWorldGen    文件:BlockTNT.java   
public void explode(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase igniter)
{
    if (!worldIn.isRemote)
    {
        if (((Boolean)state.getValue(EXPLODE)).booleanValue())
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), igniter);
            worldIn.spawnEntityInWorld(entitytntprimed);
            worldIn.playSound((EntityPlayer)null, entitytntprimed.posX, entitytntprimed.posY, entitytntprimed.posZ, SoundEvents.ENTITY_TNT_PRIMED, SoundCategory.BLOCKS, 1.0F, 1.0F);
        }
    }
}
项目:ThermosRebased    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:Thermos    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityFallingBlock // PaperSpigot - Always tick falling blocks
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:KCauldron    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:CauldronGit    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:Cauldron-Old    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:morecommands    文件:CommandCannon.java   
@Override
public String execute(CommandSender sender, String[] params) throws CommandException {
    Entity entity = getSenderAsEntity(sender.getMinecraftISender(), Entity.class);

    EntityTNTPrimed tnt = new EntityTNTPrimed(entity.world);

    tnt.setLocationAndAngles(entity.getPosition().getX(), entity.getPosition().getY() + 1, entity.getPosition().getZ(), entity.rotationYaw, entity.rotationPitch);
    tnt.setFuse(40);
    tnt.motionX = -MathHelper.sin((tnt.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((tnt.rotationPitch / 180F) * 3.141593F);
    tnt.motionZ = MathHelper.cos((tnt.rotationYaw / 180F) * 3.141593F) * MathHelper.cos((tnt.rotationPitch / 180F) * 3.141593F);
    tnt.motionY = -MathHelper.sin((tnt.rotationPitch / 180F) * 3.141593F);

    double multiplier = 1;
    if (params.length > 0) {
        try {multiplier = Double.parseDouble(params[0]);} 
        catch (NumberFormatException e) {throw new CommandException("command.cannon.NAN", sender);}
    }

    tnt.motionX *= multiplier;
    tnt.motionY *= multiplier;
    tnt.motionZ *= multiplier;

    entity.world.spawnEntity(tnt);
    sender.sendLangfileMessage("command.cannon.success");

    return null;
}
项目:Cauldron-Reloaded    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity instanceof EntityPlayer && !(entity instanceof FakePlayer)) // Cauldron
            || entity instanceof EntityThrowable
            || entity instanceof EntityDragon
            || entity instanceof EntityDragonPart
            || entity instanceof EntityWither
            || entity instanceof EntityFireball
            || entity instanceof EntityWeatherEffect
            || entity instanceof EntityTNTPrimed
            || entity instanceof EntityEnderCrystal
            || entity instanceof EntityFireworkRocket
            || entity instanceof EntityVillager
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:KeyCraft    文件:BlockTrapTNT.java   
/** �����鱻ը��ʱ ����������ը�� */
public void onBlockDestroyedByExplosion(World world, int posX, int posY, int posZ, Explosion exp) {
    if (!world.isRemote) {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, posX + 0.5F, posY + 0.5F, posZ + 0.5F, exp.getExplosivePlacedBy());
        entitytntprimed.fuse = world.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
        world.spawnEntityInWorld(entitytntprimed);
        world.removeTileEntity(posX, posY, posZ);
    }
}
项目:FFoKC    文件:ActivationRange.java   
/**
 * These entities are excluded from Activation range checks.
 *
 * @param entity
 * @param world
 * @return boolean If it should always tick.
 */
public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config)
{
    // Cauldron start - another fix for Proxy Worlds
    if (config == null && DimensionManager.getWorld(0) != null)
    {
        config = DimensionManager.getWorld(0).spigotConfig;
    }
    else
    {
        return true;
    }
    // Cauldron end

    if ( ( entity.activationType == 3 && config.miscActivationRange == 0 )
            || ( entity.activationType == 2 && config.animalActivationRange == 0 )
            || ( entity.activationType == 1 && config.monsterActivationRange == 0 )
            || (entity.getClass().equals(EntityPlayer.class) && !(entity.getClass().equals(FakePlayer.class))) // Cauldron
            || entity.getClass().equals(EntityThrowable.class)
            || entity.getClass().equals(EntityDragon.class)
            || entity.getClass().equals(EntityDragonPart.class)
            || entity.getClass().equals(EntityWither.class)
            || entity.getClass().equals(EntityFireball.class)
            || entity.getClass().equals(EntityWeatherEffect.class)
            || entity.getClass().equals(EntityTNTPrimed.class)
            || entity.getClass().equals(EntityFallingBlock.class)
            || entity.getClass().equals(EntityEnderCrystal.class)
            || entity.getClass().equals(EntityFireworkRocket.class)
            || entity.getClass().equals(EntityVillager.class)
            // Cauldron start - force ticks for entities with superclass of Entity and not a creature/monster
            || (entity.getClass().getSuperclass() == Entity.class && !entity.isCreatureType(EnumCreatureType.creature, false)
            && !entity.isCreatureType(EnumCreatureType.ambient, false) && !entity.isCreatureType(EnumCreatureType.monster, false)
            && !entity.isCreatureType(EnumCreatureType.waterCreature, false)))
    {
        return true;
    }

    return false;
}
项目:Wars-Mod    文件:ItemAdminWandTNT.java   
@Override
   public ActionResult<ItemStack> onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer, EnumHand hand) {
    if (!world.isRemote) {
        Vec3d look = entityplayer.getLookVec();
        EntityTNTPrimed tntPrimed = new EntityTNTPrimed(world);
        tntPrimed.setPosition(entityplayer.posX + look.xCoord * 0, entityplayer.posY + look.yCoord * 0, entityplayer.posZ + look.zCoord * 0);
        tntPrimed.motionX = look.xCoord * 0.1;
        tntPrimed.motionY = look.yCoord * 0.1;
        tntPrimed.motionZ = look.zCoord * 0.1;
        world.spawnEntityInWorld(tntPrimed);
    }
    return new ActionResult(EnumActionResult.PASS, itemstack);
}
项目:Resilience-Client-Source    文件:BlockTNT.java   
/**
 * Called upon the block being destroyed by an explosion
 */
public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_)
{
    if (!p_149723_1_.isClient)
    {
        EntityTNTPrimed var6 = new EntityTNTPrimed(p_149723_1_, (double)((float)p_149723_2_ + 0.5F), (double)((float)p_149723_3_ + 0.5F), (double)((float)p_149723_4_ + 0.5F), p_149723_5_.getExplosivePlacedBy());
        var6.fuse = p_149723_1_.rand.nextInt(var6.fuse / 4) + var6.fuse / 8;
        p_149723_1_.spawnEntityInWorld(var6);
    }
}
项目:Resilience-Client-Source    文件:BlockTNT.java   
public void func_150114_a(World p_150114_1_, int p_150114_2_, int p_150114_3_, int p_150114_4_, int p_150114_5_, EntityLivingBase p_150114_6_)
{
    if (!p_150114_1_.isClient)
    {
        if ((p_150114_5_ & 1) == 1)
        {
            EntityTNTPrimed var7 = new EntityTNTPrimed(p_150114_1_, (double)((float)p_150114_2_ + 0.5F), (double)((float)p_150114_3_ + 0.5F), (double)((float)p_150114_4_ + 0.5F), p_150114_6_);
            p_150114_1_.spawnEntityInWorld(var7);
            p_150114_1_.playSoundAtEntity(var7, "game.tnt.primed", 1.0F, 1.0F);
        }
    }
}
项目:Rediscovered-Mod-1.8.8    文件:EntityBeastBoy.java   
public EntityBeastBoy(World par1World)
{
    super(par1World);
    field_48119_b = 0;
    villageObj = null;
    type = rand.nextInt(3);
    //animSpeed = (float)(Math.random() * 0.89999997615814209D + 0.10000000149011612D);
    animSpeed = (float)(0.89999997615814209D);
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    tasks.addTask(1, new EntityAIAttackOnCollide(this, 0.25F, true));
    tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.22F, 32F));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityTNTPrimed.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityCreeper.class, 8.0F, 0.6D, 0.6D));
    tasks.addTask(5, new EntityAIMoveThroughVillage(this, 0.16F, true));
    tasks.addTask(6, new EntityAIMoveTowardsRestriction(this, 0.16F));
    tasks.addTask(8, new EntityAIWander(this, 0.16F));
    tasks.addTask(9, new EntityAIWatchClosest2(this, net.minecraft.entity.player.EntityPlayer.class, 3F, 1.0F));
    tasks.addTask(10, new EntityAIWatchClosest2(this, net.minecraft.entity.passive.EntityVillager.class, 5F, 0.02F));
    tasks.addTask(11, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityRana.class, 5F, 0.02F));
    tasks.addTask(12, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityBeastBoy.class, 5F, 0.02F));
    tasks.addTask(13, new EntityAILookIdle(this));
    tasks.addTask(14, new EntityAIRestrictOpenDoor(this));
    tasks.addTask(15, new EntityAIOpenDoor(this, true));
    targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
    if(mod_Rediscovered.BeastBoyHostile)
        this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.applyEntityAI();
}
项目:Rediscovered-Mod-1.8.8    文件:EntityMeleePigman.java   
public EntityMeleePigman(World par1World)
{
    super(par1World);
    field_48119_b = 0;
    villageObj = null;
    type = rand.nextInt(3);
    animSpeed = (float)(0.89999997615814209D);
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    tasks.addTask(1, new EntityAIAttackOnCollide(this, 0.25F, true));
    tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.22F, 32F));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityTNTPrimed.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityCreeper.class, 8.0F, 0.6D, 0.6D));
    tasks.addTask(3, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    tasks.addTask(5, new EntityAIMoveThroughVillage(this, 0.16F, true));
    tasks.addTask(6, new EntityAIMoveTowardsRestriction(this, 0.16F));
    tasks.addTask(8, new EntityAIWander(this, 0.16F));
    tasks.addTask(9, new EntityAIWatchClosest2(this, net.minecraft.entity.player.EntityPlayer.class, 3F, 1.0F));
    tasks.addTask(10, new EntityAIWatchClosest2(this, net.minecraft.entity.passive.EntityVillager.class, 5F, 0.02F));
    tasks.addTask(11, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityRana.class, 5F, 0.02F));
    tasks.addTask(12, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityBlackSteve.class, 5F, 0.02F));
    tasks.addTask(13, new EntityAILookIdle(this));
    tasks.addTask(14, new EntityAIRestrictOpenDoor(this));
    tasks.addTask(15, new EntityAIOpenDoor(this, true));
    targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
    this.applyEntityAI();
    if (par1World != null && !par1World.isRemote)
    {
        this.setCombatTask();
    }
}
项目:Rediscovered-Mod-1.8.8    文件:EntitySteve.java   
public EntitySteve(World par1World)
{
    super(par1World);
    field_48119_b = 0;
    villageObj = null;
    type = rand.nextInt(3);
    //animSpeed = (float)(Math.random() * 0.89999997615814209D + 0.10000000149011612D);
    animSpeed = (float)(0.89999997615814209D);
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    tasks.addTask(1, new EntityAIAttackOnCollide(this, 0.25F, true));
    tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.22F, 32F));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityTNTPrimed.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityCreeper.class, 8.0F, 0.6D, 0.6D));
    tasks.addTask(5, new EntityAIMoveThroughVillage(this, 0.16F, true));
    tasks.addTask(6, new EntityAIMoveTowardsRestriction(this, 0.16F));
    tasks.addTask(8, new EntityAIWander(this, 0.16F));
    tasks.addTask(9, new EntityAIWatchClosest2(this, net.minecraft.entity.player.EntityPlayer.class, 3F, 1.0F));
    tasks.addTask(10, new EntityAIWatchClosest2(this, net.minecraft.entity.passive.EntityVillager.class, 5F, 0.02F));
    tasks.addTask(11, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityRana.class, 5F, 0.02F));
    tasks.addTask(12, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntitySteve.class, 5F, 0.02F));
    tasks.addTask(13, new EntityAILookIdle(this));
    tasks.addTask(14, new EntityAIRestrictOpenDoor(this));
    tasks.addTask(15, new EntityAIOpenDoor(this, true));
    targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityZombie.class, 1.0D, false));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntitySkeleton.class, 1.0D, false));
    this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntitySpider.class, 1.0D, false));
    if(mod_Rediscovered.SteveHostile)
        this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.applyEntityAI();
}
项目:Rediscovered-Mod-1.8.8    文件:EntityBlackSteve.java   
public EntityBlackSteve(World par1World)
{
    super(par1World);
    field_48119_b = 0;
    villageObj = null;
    type = rand.nextInt(3);
    //animSpeed = (float)(Math.random() * 0.89999997615814209D + 0.10000000149011612D);
    animSpeed = (float)(0.89999997615814209D);
    ((PathNavigateGround)this.getNavigator()).setAvoidsWater(true);
    tasks.addTask(1, new EntityAIAttackOnCollide(this, 0.25F, true));
    tasks.addTask(2, new EntityAIMoveTowardsTarget(this, 0.22F, 32F));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityTNTPrimed.class, 8.0F, 0.6D, 0.6D));
    this.tasks.addTask(1, new EntityAIAvoidEntity(this, EntityCreeper.class, 8.0F, 0.6D, 0.6D));
    tasks.addTask(5, new EntityAIMoveThroughVillage(this, 0.16F, true));
    tasks.addTask(6, new EntityAIMoveTowardsRestriction(this, 0.16F));
    tasks.addTask(8, new EntityAIWander(this, 0.16F));
    tasks.addTask(9, new EntityAIWatchClosest2(this, net.minecraft.entity.player.EntityPlayer.class, 3F, 1.0F));
    tasks.addTask(10, new EntityAIWatchClosest2(this, net.minecraft.entity.passive.EntityVillager.class, 5F, 0.02F));
    tasks.addTask(11, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityRana.class, 5F, 0.02F));
    tasks.addTask(12, new EntityAIWatchClosest2(this, com.stormister.rediscovered.EntityBeastBoy.class, 5F, 0.02F));
    tasks.addTask(13, new EntityAILookIdle(this));
    tasks.addTask(14, new EntityAIRestrictOpenDoor(this));
    tasks.addTask(15, new EntityAIOpenDoor(this, true));
    targetTasks.addTask(2, new EntityAIHurtByTarget(this, false));
    if(mod_Rediscovered.BlackSteveHostile)
        this.tasks.addTask(2, new EntityAIAttackOnCollide(this, EntityPlayer.class, 1.0D, false));
    this.applyEntityAI();
}
项目:Helper-API    文件:ExplosiveBlockHelper.java   
public void onBlockDestroyedByPlayer(World world, int x, int y, int z, int radius)
{
    super.onBlockDestroyedByPlayer(world, x, y, z, radius);
    if (!world.isRemote)
    {
        world.createExplosion(new EntityTNTPrimed(world), x, y, z, explosionRadius, true);
    }
}
项目:BeanCraft    文件:BlockSirJamloBlock.java   
public void func_150114_a(World world, int i, int i1, int i2, int i3, EntityLivingBase p_150114_6_)
{
    if (!world.isRemote)
    {
        if ((i3 & 1) == 1)
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double)((float)i + 0.5F), (double)((float)i1 + 0.5F), (double)((float)i2 + 0.5F), p_150114_6_);
            world.spawnEntityInWorld(entitytntprimed);
            world.playSoundAtEntity(entitytntprimed, "game.tnt.primed", 1.0F, 1.0F);
        }
    }
}
项目:MinExtension    文件:ExplosiveBlockHelper.java   
public void onBlockDestroyedByPlayer(World world, int i, int j, int k, int p_149664_5_)
{
    if (!world.isRemote)
    {
        world.createExplosion(new EntityTNTPrimed(world), i, j, k, explosionRadius, true);
    }
    super.onBlockDestroyedByPlayer(world, i, j, k, p_149664_5_);
}
项目:ExpandedRailsMod    文件:BlockTNT.java   
/**
 * Called when this Block is destroyed by an Explosion
 */
public void onBlockDestroyedByExplosion(World worldIn, BlockPos pos, Explosion explosionIn)
{
    if (!worldIn.isRemote)
    {
        EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(worldIn, (double)((float)pos.getX() + 0.5F), (double)pos.getY(), (double)((float)pos.getZ() + 0.5F), explosionIn.getExplosivePlacedBy());
        entitytntprimed.setFuse((short)(worldIn.rand.nextInt(entitytntprimed.getFuse() / 4) + entitytntprimed.getFuse() / 8));
        worldIn.spawnEntityInWorld(entitytntprimed);
    }
}