當前位置: 首頁>>代碼示例>>Java>>正文


Java EnumParticleTypes類代碼示例

本文整理匯總了Java中net.minecraft.util.EnumParticleTypes的典型用法代碼示例。如果您正苦於以下問題:Java EnumParticleTypes類的具體用法?Java EnumParticleTypes怎麽用?Java EnumParticleTypes使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EnumParticleTypes類屬於net.minecraft.util包,在下文中一共展示了EnumParticleTypes類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: randomDisplayTick

import net.minecraft.util.EnumParticleTypes; //導入依賴的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.5D;
    double d1 = (double)pos.getY() + 0.7D;
    double d2 = (double)pos.getZ() + 0.5D;
    double d3 = 0.22D;
    double d4 = 0.27D;

    if (enumfacing.getAxis().isHorizontal())
    {
        EnumFacing enumfacing1 = enumfacing.getOpposite();
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0 + 0.27D * (double)enumfacing1.getFrontOffsetX(), d1 + 0.22D, d2 + 0.27D * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, d0 + 0.27D * (double)enumfacing1.getFrontOffsetX(), d1 + 0.22D, d2 + 0.27D * (double)enumfacing1.getFrontOffsetZ(), 0.0D, 0.0D, 0.0D, new int[0]);
    }
    else
    {
        worldIn.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
        worldIn.spawnParticle(EnumParticleTypes.FLAME, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:BlockTorch.java

示例2: doClientRenderEffects

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
/**
 * Generates particle effects appropriate to the phase (or sometimes sounds).
 * Called by dragon's onLivingUpdate. Only used when worldObj.isRemote.
 */
public void doClientRenderEffects()
{
    Vec3d vec3d = this.dragon.getHeadLookVec(1.0F).normalize();
    vec3d.rotateYaw(-((float)Math.PI / 4F));
    double d0 = this.dragon.dragonPartHead.posX;
    double d1 = this.dragon.dragonPartHead.posY + (double)(this.dragon.dragonPartHead.height / 2.0F);
    double d2 = this.dragon.dragonPartHead.posZ;

    for (int i = 0; i < 8; ++i)
    {
        double d3 = d0 + this.dragon.getRNG().nextGaussian() / 2.0D;
        double d4 = d1 + this.dragon.getRNG().nextGaussian() / 2.0D;
        double d5 = d2 + this.dragon.getRNG().nextGaussian() / 2.0D;
        this.dragon.worldObj.spawnParticle(EnumParticleTypes.DRAGON_BREATH, d3, d4, d5, -vec3d.xCoord * 0.07999999821186066D + this.dragon.motionX, -vec3d.yCoord * 0.30000001192092896D + this.dragon.motionY, -vec3d.zCoord * 0.07999999821186066D + this.dragon.motionZ, new int[0]);
        vec3d.rotateYaw(0.19634955F);
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:22,代碼來源:PhaseLanding.java

示例3: transformBedrock

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
private void transformBedrock(World world, BlockPos pos) {
	
	Iterable<BlockPos> poslist = BlockPos.getAllInBox(pos.add(-range, -range, -range), pos.add(range, 0, range));
	Iterator posit = poslist.iterator();
	while (posit.hasNext()) {
		BlockPos looppos = (BlockPos)posit.next();
		if (!world.isAirBlock(looppos) && world.getBlockState(looppos).getBlock() == Blocks.BEDROCK) {
			if (looppos.getY() <= 1) continue;
			if (world.rand.nextBoolean()) {
				world.setBlockState(looppos, UCBlocks.darkBlock.getDefaultState(), 2);
				UCPacketHandler.sendToNearbyPlayers(world, looppos, new PacketUCEffect(EnumParticleTypes.CLOUD, looppos.getX(), looppos.getY(), looppos.getZ(), 6));
				return;
			}
		}
	}
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:17,代碼來源:Petramia.java

示例4: randomDisplayTick

import net.minecraft.util.EnumParticleTypes; //導入依賴的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

示例5: onItemUse

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	
	if (stack.getItemDamage() == EnumItems.TIMEMEAL.ordinal() && player.canPlayerEdit(pos, facing, stack)) {
		Block crops = world.getBlockState(pos).getBlock();
		if (crops != null && crops instanceof BlockCrops) {
			if (crops != UCBlocks.cropMerlinia)
				world.setBlockState(pos, ((BlockCrops)crops).withAge(0), 2);
			else if (crops == UCBlocks.cropMerlinia)
				((Merlinia)crops).merliniaGrowth(world, pos, world.rand.nextInt(1) + 1);
			else if (crops instanceof BlockNetherWart)
				((BlockNetherWart)crops).updateTick(world, pos, world.getBlockState(pos), world.rand);
			if (!player.capabilities.isCreativeMode && !player.worldObj.isRemote)
				stack.stackSize--;
			UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.VILLAGER_HAPPY, pos.getX() - 0.5D, pos.getY(), pos.getZ() - 0.5D, 6));
			return EnumActionResult.SUCCESS;
		}
	}
	return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:20,代碼來源:ItemGeneric.java

示例6: onExecutionStart

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
@Override
public void onExecutionStart(EntityPlayer player)
{
	ItemStack is = player.getHeldItemMainhand().isEmpty() ? player.getHeldItemOffhand() : player.getHeldItemMainhand();
	EnumWeaponWeight weight = EnumWeaponWeight.getWeaponWeight(is);
	player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_NODAMAGE, SoundCategory.PLAYERS, 1, 1F);
	Vec3d look = player.getLookVec().scale(5);
	Vec3d pos = player.getPositionVector();
	List<EntityLivingBase> targets = Helpers.rayTraceEntities(player.world, pos.addVector(0, player.getEyeHeight(), 0), look, Optional.of(e -> e != player), EntityLivingBase.class);
	EntityLivingBase assumedToBeLookedAt = Helpers.getClosest(targets, player);
	if (assumedToBeLookedAt != null)
	{
		if (!player.world.isRemote)
		{
			assumedToBeLookedAt.addPotionEffect(new PotionEffect(ExPPotions.stunned, weight == EnumWeaponWeight.NORMAL ? 20 : 30, 0, false, false));
		}
		
		player.world.playSound(player, player.getPosition(), SoundEvents.ENTITY_PLAYER_ATTACK_KNOCKBACK, SoundCategory.PLAYERS, 1, 1F);
		Vec3d targetPos = assumedToBeLookedAt.getPositionVector();
		assumedToBeLookedAt.knockBack(player, 1, pos.x - targetPos.x, pos.z - targetPos.z);
		for (int i = 0; i < 50; ++i)
		{
			player.world.spawnParticle(EnumParticleTypes.CRIT_MAGIC, targetPos.x + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + assumedToBeLookedAt.getEyeHeight() + player.world.rand.nextDouble() - player.world.rand.nextDouble(), targetPos.z + player.world.rand.nextDouble() - player.world.rand.nextDouble(), 0, -0.1, 0);
		}
	}
}
 
開發者ID:V0idWa1k3r,項目名稱:ExPetrum,代碼行數:27,代碼來源:DownStrike.java

示例7: onLivingUpdate

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
/**
 * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
 * use this to react to sunlight and start to burn.
 */
public void onLivingUpdate()
{
    super.onLivingUpdate();

    if (this.getGrowingAge() != 0)
    {
        this.inLove = 0;
    }

    if (this.inLove > 0)
    {
        --this.inLove;

        if (this.inLove % 10 == 0)
        {
            double d0 = this.rand.nextGaussian() * 0.02D;
            double d1 = this.rand.nextGaussian() * 0.02D;
            double d2 = this.rand.nextGaussian() * 0.02D;
            this.worldObj.spawnParticle(EnumParticleTypes.HEART, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2, new int[0]);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:27,代碼來源:EntityAnimal.java

示例8: randomDisplayTick

import net.minecraft.util.EnumParticleTypes; //導入依賴的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

示例9: randomDisplayTick

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
@SideOnly(Side.CLIENT)
public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand)
{
    if (this.isRepeaterPowered)
    {
        EnumFacing enumfacing = (EnumFacing)stateIn.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)stateIn.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:F1r3w477,項目名稱:CustomWorldGen,代碼行數:23,代碼來源:BlockRedstoneRepeater.java

示例10: onLivingUpdate

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
/**
 * Called frequently so the entity can update its state every tick as required. For example, zombies and skeletons
 * use this to react to sunlight and start to burn.
 */
public void onLivingUpdate()
{
    if (!this.onGround && this.motionY < 0.0D)
    {
        this.motionY *= 0.6D;
    }

    if (this.worldObj.isRemote)
    {
        if (this.rand.nextInt(24) == 0 && !this.isSilent())
        {
            this.worldObj.playSound(this.posX + 0.5D, this.posY + 0.5D, this.posZ + 0.5D, "fire.fire", 1.0F + this.rand.nextFloat(), this.rand.nextFloat() * 0.7F + 0.3F, false);
        }

        for (int i = 0; i < 2; ++i)
        {
            this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_LARGE, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, 0.0D, 0.0D, 0.0D, new int[0]);
        }
    }

    super.onLivingUpdate();
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:27,代碼來源:EntityBlaze.java

示例11: renderBrokenItemStack

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
/**
 * Renders broken item particles using the given ItemStack
 */
public void renderBrokenItemStack(ItemStack stack)
{
    this.playSound("random.break", 0.8F, 0.8F + this.worldObj.rand.nextFloat() * 0.4F);

    for (int i = 0; i < 5; ++i)
    {
        Vec3 vec3 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
        vec3 = vec3.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
        vec3 = vec3.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
        double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
        Vec3 vec31 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
        vec31 = vec31.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
        vec31 = vec31.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
        vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);
        this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:21,代碼來源:EntityLivingBase.java

示例12: spawnExplosionParticle

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
/**
 * Spawns an explosion particle around the Entity's location
 */
public void spawnExplosionParticle()
{
    if (this.worldObj.isRemote)
    {
        for (int i = 0; i < 20; ++i)
        {
            double d0 = this.rand.nextGaussian() * 0.02D;
            double d1 = this.rand.nextGaussian() * 0.02D;
            double d2 = this.rand.nextGaussian() * 0.02D;
            double d3 = 10.0D;
            this.worldObj.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d0 * d3, this.posY + (double)(this.rand.nextFloat() * this.height) - d1 * d3, this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width - d2 * d3, d0, d1, d2, new int[0]);
        }
    }
    else
    {
        this.worldObj.setEntityState(this, (byte)20);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:EntityLiving.java

示例13: spawnPotionParticles

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
private void spawnPotionParticles(int particleCount)
{
    int i = this.getColor();

    if (i != 0 && particleCount > 0)
    {
        double d0 = (double)(i >> 16 & 255) / 255.0D;
        double d1 = (double)(i >> 8 & 255) / 255.0D;
        double d2 = (double)(i >> 0 & 255) / 255.0D;

        for (int j = 0; j < particleCount; ++j)
        {
            this.worldObj.spawnParticle(EnumParticleTypes.SPELL_MOB, this.posX + (this.rand.nextDouble() - 0.5D) * (double)this.width, this.posY + this.rand.nextDouble() * (double)this.height, this.posZ + (this.rand.nextDouble() - 0.5D) * (double)this.width, d0, d1, d2, new int[0]);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:17,代碼來源:EntityTippedArrow.java

示例14: onUpdate

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
@Override
public void onUpdate() {
	
	super.onUpdate();
	double velY = 0;
	if (this.ticksExisted > 40)
	{
		velY = 0.0625D;
		if (this.posY >= 256) {
			this.setDead();
		}
		this.addVelocity(0, velY, 0);
		if (this.ticksExisted % 10 == 0 && this.isCollided)
		{
			UCPacketHandler.sendToNearbyPlayers(worldObj, getPosition(), new PacketUCEffect(EnumParticleTypes.EXPLOSION_NORMAL, this.posX, this.posY, this.posZ, 3));
			this.setDead();
		}
	}
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:20,代碼來源:EntityItemPlum.java

示例15: randomDisplayTick

import net.minecraft.util.EnumParticleTypes; //導入依賴的package包/類
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand)
{
    if (this.isOn)
    {
        double d0 = (double)pos.getX() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D;
        double d1 = (double)pos.getY() + 0.7D + (rand.nextDouble() - 0.5D) * 0.2D;
        double d2 = (double)pos.getZ() + 0.5D + (rand.nextDouble() - 0.5D) * 0.2D;
        EnumFacing enumfacing = (EnumFacing)state.getValue(FACING);

        if (enumfacing.getAxis().isHorizontal())
        {
            EnumFacing enumfacing1 = enumfacing.getOpposite();
            double d3 = 0.27D;
            d0 += 0.27D * (double)enumfacing1.getFrontOffsetX();
            d1 += 0.22D;
            d2 += 0.27D * (double)enumfacing1.getFrontOffsetZ();
        }

        worldIn.spawnParticle(EnumParticleTypes.REDSTONE, d0, d1, d2, 0.0D, 0.0D, 0.0D, new int[0]);
    }
}
 
開發者ID:SkidJava,項目名稱:BaseClient,代碼行數:22,代碼來源:BlockRedstoneTorch.java


注:本文中的net.minecraft.util.EnumParticleTypes類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。