當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。