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


Java World.spawnParticle方法代码示例

本文整理汇总了Java中net.minecraft.world.World.spawnParticle方法的典型用法代码示例。如果您正苦于以下问题:Java World.spawnParticle方法的具体用法?Java World.spawnParticle怎么用?Java World.spawnParticle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.World的用法示例。


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

示例1: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (rand.nextInt(16) == 0)
    {
        BlockPos blockpos = pos.down();

        if (canFallThrough(worldIn.getBlockState(blockpos)))
        {
            double d0 = (double)((float)pos.getX() + rand.nextFloat());
            double d1 = (double)pos.getY() - 0.05D;
            double d2 = (double)((float)pos.getZ() + rand.nextFloat());
            worldIn.spawnParticle(EnumParticleTypes.FALLING_DUST, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[] {Block.getStateId(stateIn)});
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:BlockFalling.java

示例2: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
	double d0 = (double)pos.getX() + 0.5D;
	double d1 = (double)pos.getY() + 0.15D;
	double d2 = (double)pos.getZ() + 0.5D;
	double d3 = 0.22D;
	double d4 = 0.27D;

	if(worldIn.getTileEntity(pos) instanceof TileEntityPan)
	{
		if(((TileEntityPan)worldIn.getTileEntity(pos)).isCooking())
		{
			worldIn.spawnParticle(EnumParticleTypes.FLAME, d0+(RANDOM.nextDouble()/1.5 - 0.35), d1, d2+(RANDOM.nextDouble()/1.5 - 0.35), 0.0D, 0.0D, 0.0D, new int[0]);
			worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0+(RANDOM.nextDouble()/1.5 - 0.35), d1, d2+(RANDOM.nextDouble()/1.5 - 0.35), 0.0D, 0.0D, 0.0D, new int[0]);
		}
	}
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:19,代码来源:BlockPan.java

示例3: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (this.isRepeaterPowered)
    {
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);
        double d0 = (double)((float)pos.getX() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D;
        double d1 = (double)((float)pos.getY() + 0.4F) + (double)(rand.nextFloat() - 0.5F) * 0.2D;
        double d2 = (double)((float)pos.getZ() + 0.5F) + (double)(rand.nextFloat() - 0.5F) * 0.2D;
        float f = -5.0F;

        if (rand.nextBoolean())
        {
            f = (float)(((Integer)state.getValue(DELAY)).intValue() * 2 - 1);
        }

        f = f / 16.0F;
        double d3 = (double)(f * (float)enumfacing.getFrontOffsetX());
        double d4 = (double)(f * (float)enumfacing.getFrontOffsetZ());
        worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0 + d3, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:22,代码来源:BlockRedstoneRepeater.java

示例4: onMessage

import net.minecraft.world.World; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public IMessage onMessage(final MessageSoulDrainFX message, final MessageContext ctx) {
	World world = Minecraft.getMinecraft().world;
	if (world.isRemote) {
		for (double i = 0; i < 8; i++) {
			double xCoord = message.posX + (rand.nextDouble() - 0.5);
			double yCoord = message.posY + (rand.nextDouble() - 0.5);
			double zCoord = message.posZ + (rand.nextDouble() - 0.5);
			world.spawnParticle(EnumParticleTypes.CRIT, true, xCoord, yCoord, zCoord, (rand.nextDouble() - 0.5),
					(rand.nextDouble() - 0.5), (rand.nextDouble() - 0.5));
		}
		ParticleUtils.spawnParticleBeam(world, EnumParticleTypes.CRIT, message.posX, message.posY, message.posZ,
				message.castX, message.castY, message.castZ, 0.2);
	}
	return null;
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:18,代码来源:MessageSoulDrainFX.java

示例5: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (worldIn.canLightningStrike(pos.up()) && !World.doesBlockHaveSolidTopSurface(worldIn, pos.down()) && rand.nextInt(15) == 1)
    {
        double d0 = (double)((float)pos.getX() + rand.nextFloat());
        double d1 = (double)pos.getY() - 0.05D;
        double d2 = (double)((float)pos.getZ() + rand.nextFloat());
        worldIn.spawnParticle(EnumParticleTypes.DRIP_WATER, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:BlockLeaves.java

示例6: indicateBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
public static void indicateBlock(World world, BlockPos pos) {

        if (world != null) {
            if (world.isRemote) {
                for (int i = 0; i < 5; i++) {
                    double dx = pos.getX() + 0.5;
                    double dy = pos.getY() + 0.5;
                    double dz = pos.getZ() + 0.5;
                    world.spawnParticle(EnumParticleTypes.REDSTONE, dx, dy, dz, 0, 0, 0);
                }
            } else {
                NetworkHandler.sendToAllAround(new PacketDebugBlock(pos), world);
            }
        }
    }
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:16,代码来源:Debugger.java

示例7: doSingleFire

import net.minecraft.world.World; //导入方法依赖的package包/类
@Override
public void doSingleFire(ItemStack stack, World world, Entity entity)		// Server side
{
	if (this.getCooldown(stack) != 0) { return; }	// Hasn't cooled down yet

	// SFX
	world.playSoundAtEntity(entity, "random.bow", 1.0F, 0.5F);

	// Firing
	BlazeShot entityarrow = new BlazeShot(world, entity, (float) this.Speed);

	// Random Damage
	int dmg_range = this.DmgMax - this.DmgMin; 	// If max dmg is 20 and min is 10, then the range will be 10
	int dmg = world.rand.nextInt(dmg_range + 1);// Range will be between 0 and 10
	dmg += this.DmgMin;							// Adding the min dmg of 10 back on top, giving us the proper damage range (10-20)

	entityarrow.damage = dmg;
	entityarrow.knockbackStrength = this.Knockback;	// Comes with an inbuild knockback II
	entityarrow.fireDuration = this.FireDur;
	entityarrow.ticksInGroundMax = 200;			// 200 ticks for 10 sec

	world.spawnEntityInWorld(entityarrow);	// pew

	// SFX
	world.playSoundAtEntity(entity, "random.wood_click", 1.0F, 0.5F);
	world.spawnParticle("smoke", entity.posX, entity.posY + 0.5D, entity.posZ, 0.0D, 0.0D, 0.0D);

	this.consumeAmmo(stack, entity, 1);
	this.setCooldown(stack, 10);
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:31,代码来源:Crossbow_Blaze.java

示例8: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    double d0 = (double)((float)pos.getX() + 0.4F + rand.nextFloat() * 0.2F);
    double d1 = (double)((float)pos.getY() + 0.7F + rand.nextFloat() * 0.3F);
    double d2 = (double)((float)pos.getZ() + 0.4F + rand.nextFloat() * 0.2F);
    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:9,代码来源:BlockBrewingStand.java

示例9: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (this.isBurning)
    {
        EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING);
        double d0 = (double)pos.getX() + 0.5D;
        double d1 = (double)pos.getY() + rand.nextDouble() * 6.0D / 16.0D;
        double d2 = (double)pos.getZ() + 0.5D;
        double d3 = 0.52D;
        double d4 = rand.nextDouble() * 0.6D - 0.3D;

        if (rand.nextDouble() < 0.1D)
        {
            worldIn.playSound((double)pos.getX() + 0.5D, (double)pos.getY(), (double)pos.getZ() + 0.5D, SoundEvents.BLOCK_FURNACE_FIRE_CRACKLE, SoundCategory.BLOCKS, 1.0F, 1.0F, false);
        }

        switch (enumfacing)
        {
            case WEST:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 - 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 - 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                break;

            case EAST:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.52D, d1, d2 + d4, 0.0D, 0.0D, 0.0D, new int[0]);
                break;

            case NORTH:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 - 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 - 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                break;

            case SOUTH:
                worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + d4, d1, d2 + 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
                worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + d4, d1, d2 + 0.52D, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:41,代码来源:BlockFurnace.java

示例10: triggerMixEffects

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void triggerMixEffects(World worldIn, BlockPos pos)
{
    double d0 = (double)pos.getX();
    double d1 = (double)pos.getY();
    double d2 = (double)pos.getZ();
    worldIn.playSound((EntityPlayer)null, pos, SoundEvents.BLOCK_LAVA_EXTINGUISH, SoundCategory.BLOCKS, 0.5F, 2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

    for (int i = 0; i < 8; ++i)
    {
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(), 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:BlockLiquid.java

示例11: tryHydrateBlock

import net.minecraft.world.World; //导入方法依赖的package包/类
public void tryHydrateBlock(EntityPlayer player, int tier, BlockPos pos, World w, IBlockState state, IFluidHandlerItem cap, ItemStack is)
{
	while ((state.getMaterial() == Material.PLANTS || w.isAirBlock(pos)) && pos.getY() > 0)
	{
		pos = pos.down();
		state = w.getBlockState(pos);
	}
	
	if (state.getBlock() instanceof IAcceptsWaterCan)
	{
		((IAcceptsWaterCan)state.getBlock()).acceptWatering(player, w, pos, state, cap, is, tier);
	}
	
	w.spawnParticle(EnumParticleTypes.WATER_SPLASH, pos.getX() + w.rand.nextFloat(), pos.getY() + 1, pos.getZ() + w.rand.nextFloat(), 0, 0, 0);
}
 
开发者ID:V0idWa1k3r,项目名称:ExPetrum,代码行数:16,代码来源:ItemWateringCan.java

示例12: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    double d0 = (double)((float)pos.getX() + 0.4F + rand.nextFloat() * 0.2F);
    double d1 = (double)((float)pos.getY() + 0.7F + rand.nextFloat() * 0.3F);
    double d2 = (double)((float)pos.getZ() + 0.4F + rand.nextFloat() * 0.2F);
    worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:BlockBrewingStand.java

示例13: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    super.randomDisplayTick(stateIn, worldIn, pos, rand);

    for (int i = -2; i <= 2; ++i)
    {
        for (int j = -2; j <= 2; ++j)
        {
            if (i > -2 && i < 2 && j == -1)
            {
                j = 2;
            }

            if (rand.nextInt(16) == 0)
            {
                for (int k = 0; k <= 1; ++k)
                {
                    BlockPos blockpos = pos.add(i, k, j);

                    if (worldIn.getBlockState(blockpos).getBlock() == Blocks.BOOKSHELF)
                    {
                        if (!worldIn.isAirBlock(pos.add(i / 2, 0, j / 2)))
                        {
                            break;
                        }

                        worldIn.spawnParticle(EnumParticleTypes.ENCHANTMENT_TABLE, (double)pos.getX() + 0.5D, (double)pos.getY() + 2.0D, (double)pos.getZ() + 0.5D, (double)((float)i + rand.nextFloat()) - 0.5D, (double)((float)k - rand.nextFloat() - 1.0F), (double)((float)j + rand.nextFloat()) - 0.5D, new int[0]);
                    }
                }
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:34,代码来源:BlockEnchantmentTable.java

示例14: randomDisplayTick

import net.minecraft.world.World; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    EnumFacing enumfacing = (EnumFacing)stateIn.getValue(FACING);
    double d0 = (double)pos.getX() + 0.55D - (double)(rand.nextFloat() * 0.1F);
    double d1 = (double)pos.getY() + 0.55D - (double)(rand.nextFloat() * 0.1F);
    double d2 = (double)pos.getZ() + 0.55D - (double)(rand.nextFloat() * 0.1F);
    double d3 = (double)(0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F);

    if (rand.nextInt(5) == 0)
    {
        worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double)enumfacing.getFrontOffsetX() * d3, d1 + (double)enumfacing.getFrontOffsetY() * d3, d2 + (double)enumfacing.getFrontOffsetZ() * d3, rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, new int[0]);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:BlockEndRod.java

示例15: triggerMixEffects

import net.minecraft.world.World; //导入方法依赖的package包/类
protected void triggerMixEffects(World worldIn, BlockPos pos) {
	double d0 = (double) pos.getX();
	double d1 = (double) pos.getY();
	double d2 = (double) pos.getZ();
	worldIn.playSoundEffect(d0 + 0.5D, d1 + 0.5D, d2 + 0.5D, "random.fizz", 0.5F,
			2.6F + (worldIn.rand.nextFloat() - worldIn.rand.nextFloat()) * 0.8F);

	for (int i = 0; i < 8; ++i) {
		worldIn.spawnParticle(EnumParticleTypes.SMOKE_LARGE, d0 + Math.random(), d1 + 1.2D, d2 + Math.random(),
				0.0D, 0.0D, 0.0D, new int[0]);
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:BlockLiquid.java


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