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


Java EntityTNTPrimed类代码示例

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


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

示例1: triggerExplosion

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
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);
}
 
开发者ID:kenzierocks,项目名称:Annointment,代码行数:19,代码来源:EasterEggCommand.java

示例2: apply

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
@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?
}
 
开发者ID:purpleposeidon,项目名称:Factorization,代码行数:22,代码来源:BlowEntities.java

示例3: execute

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
@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;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:26,代码来源:CommandDefuse.java

示例4: EntityRana

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
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));
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.8.8,代码行数:27,代码来源:EntityRana.java

示例5: onHackFinished

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
@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);
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:HackableTNT.java

示例6: initializeEntityActivationState

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:45,代码来源:ActivationRange.java

示例7: onBlockDestroyedByExplosion

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:BlockTNT.java

示例8: explode

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:BlockTNT.java

示例9: getExplosivePlacedBy

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
@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));
    }
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:10,代码来源:Explosion.java

示例10: onBlockDestroyedByExplosion

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:BlockTNT.java

示例11: explode

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
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);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:BlockTNT.java

示例12: initializeEntityActivationState

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos,代码行数:46,代码来源:ActivationRange.java

示例13: execute

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
@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;
}
 
开发者ID:MrNobody98,项目名称:morecommands,代码行数:28,代码来源:CommandCannon.java

示例14: onBlockDestroyedByExplosion

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
/** �����鱻ը��ʱ ����������ը�� */
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);
    }
}
 
开发者ID:NullaDev,项目名称:KeyCraft,代码行数:10,代码来源:BlockTrapTNT.java

示例15: initializeEntityActivationState

import net.minecraft.entity.item.EntityTNTPrimed; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:Bogdan-G,项目名称:FFoKC,代码行数:46,代码来源:ActivationRange.java


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