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


Java ParticleManager.addEffect方法代码示例

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


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

示例1: onMessage

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SuppressWarnings({"ReturnOfNull", "ConstantConditions"})
@Override
public IMessage onMessage(SpawnCustomParticleMessage message, MessageContext ctx)
{
    final ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;

    final IForgeRegistry<ICustomParticleFactory> registry = GameRegistry.findRegistry(ICustomParticleFactory.class);
    final ICustomParticleFactory factory = registry.getValue(message.getParticleResourceLocation());

    final Particle particle = factory.getParticleFactory().createParticle(-1,
            Minecraft.getMinecraft().thePlayer.worldObj,
            message.getXCoordinate(),
            message.getYCoordinate(),
            message.getZCoordinate(),
            message.getParticleSpeed(),
            message.getParticleSpeed(),
            message.getParticleSpeed(),
            message.getParticleArgs()
    );

    effectRenderer.addEffect(particle);

    return null;
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:25,代码来源:SpawnCustomParticleMessageHandler.java

示例2: spawnBreakParticles

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
/**
 * Spawns the break particles for a block, similarly to the normal block break effect
 * particle. The intended use of this method is to override the block break effects.
 * 
 * @param manager The EffectRenderer, used to render the particle effect.
 * @param state The BlockState for the block to render the breaking effect of.
 * @param world The World to spawn the particle effect in.
 * @param pos The position to spawn the particles at.
 * @return boolean Whether or not the effect actually spawned.
 */
public static boolean spawnBreakParticles (ParticleManager manager, IBlockState state, World world, BlockPos pos) {
    
    if (state.getBlock() != null) {
        
        final int multiplier = 4;
        
        for (int xOffset = 0; xOffset < multiplier; xOffset++)
            for (int yOffset = 0; yOffset < multiplier; yOffset++)
                for (int zOffset = 0; zOffset < multiplier; zOffset++) {
                    
                    final double xPos = pos.getX() + (xOffset + 0.5D) / multiplier;
                    final double yPos = pos.getY() + (yOffset + 0.5D) / multiplier;
                    final double zPos = pos.getZ() + (zOffset + 0.5D) / multiplier;
                    manager.addEffect(new ParticleDiggingOpen(world, xPos, yPos, zPos, xPos - pos.getX() - 0.5D, yPos - pos.getY() - 0.5D, zPos - pos.getZ() - 0.5D, state).setBlockPos(pos));
                }
            
        return true;
    }
    
    return false;
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:MMDLib-old,代码行数:32,代码来源:ParticleUtils.java

示例3: spawnBreakParticles

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
/**
 * Spawns the break particles for a block, similarly to the normal block break effect
 * particle. The intended use of this method is to override the block break effects.
 *
 * @param manager The EffectRenderer, used to render the particle effect.
 * @param state The BlockState for the block to render the breaking effect of.
 * @param world The World to spawn the particle effect in.
 * @param pos The position to spawn the particles at.
 * @return boolean Whether or not the effect actually spawned.
 */
@SideOnly(Side.CLIENT)
public static boolean spawnBreakParticles (ParticleManager manager, IBlockState state, World world, BlockPos pos) {

    if (state.getBlock() != null) {

        final int multiplier = 4;

        for (int xOffset = 0; xOffset < multiplier; xOffset++) {
            for (int yOffset = 0; yOffset < multiplier; yOffset++) {
                for (int zOffset = 0; zOffset < multiplier; zOffset++) {

                    final double xPos = pos.getX() + (xOffset + 0.5D) / multiplier;
                    final double yPos = pos.getY() + (yOffset + 0.5D) / multiplier;
                    final double zPos = pos.getZ() + (zOffset + 0.5D) / multiplier;
                    manager.addEffect(new OpenParticleDigging(world, xPos, yPos, zPos, xPos - pos.getX() - 0.5D, yPos - pos.getY() - 0.5D, zPos - pos.getZ() - 0.5D, state).setBlockPos(pos));
                }
            }
        }

        return true;
    }

    return false;
}
 
开发者ID:Darkhax-Minecraft,项目名称:Bookshelf,代码行数:35,代码来源:ParticleUtils.java

示例4: addDestroyEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
    IBlockState state = world.getBlockState(pos);
    int i = 4;
    for (int j = 0; j < i; ++j) {
        for (int k = 0; k < i; ++k) {
            for (int l = 0; l < i; ++l) {
                double d0 = (double) pos.getX() + ((double) j + 0.5D) / (double) i;
                double d1 = (double) pos.getY() + ((double) k + 0.5D) / (double) i;
                double d2 = (double) pos.getZ() + ((double) l + 0.5D) / (double) i;
                effectRenderer.addEffect((new EntityDiggingFXMoarSigns(world, d0, d1, d2, d0 - (double) pos.getX() - 0.5D, d1 - (double) pos.getY() - 0.5D, d2 - (double) pos.getZ() - 0.5D, pos, state)).setBlockPos(pos));
            }
        }
    }

    return true;
}
 
开发者ID:GoryMoon,项目名称:MoarSigns,代码行数:19,代码来源:BlockMoarSign.java

示例5: addDestroyEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
	IBlockState state = world.getBlockState(pos);
	if (state == null || state.getBlock() != this) {
		return false;
	}
	state = state.getBlock().getActualState(state, world, pos);
	int i = 4;
	TextureAtlasSprite tex = null;
	TileEntity tile = world.getTileEntity(pos);
	if(Util.notNullAndInstanceOf(tile, TileEntityPipe.class)){
		TileEntityPipe pipe = ((TileEntityPipe)tile);
		tex = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(pipe.getPipeType().getCoreTexture(pipe));

		if(tex == null){
			return false;
		}
	}
	for (int j = 0; j < i; ++j) {
		for (int k = 0; k < i; ++k) {
			for (int l = 0; l < i; ++l) {
				double d0 = pos.getX() + (j + 0.5D) / i;
				double d1 = pos.getY() + (k + 0.5D) / i;
				double d2 = pos.getZ() + (l + 0.5D) / i;
				ParticleDigging fx = (ParticleDigging) new ParticleDigging.Factory().createParticle(-1, world, d0, d1, d2, d0 - pos.getX() - 0.5D,
						d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, 0);
				fx.setBlockPos(pos);
				fx.setParticleTexture(tex);
				effectRenderer.addEffect(fx);
			}
		}
	}

	return true;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:38,代码来源:BlockPipe.java

示例6: spawnTwinkleParticles

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
private void spawnTwinkleParticles(ParticleManager renderer, World w, double x, double y, double z) {
    for(int i = 0; i < 5; i++) {
        TwinkleFX fx = new TwinkleFX(w, x, y, z, true);
        fx.setOffset((Math.random() * 0.4) - 0.2, (Math.random() * 0.4) - 0.2, (Math.random() * 0.4) - 0.2);
        fx.setNoClip(true);
        fx.multipleParticleScaleBy(0.5F);
        fx.randomizeSpeed();
        fx.multiplyVelocity(0.02F);
        fx.setAlphaEffect(true);
        fx.setScaleEffect(true);
        fx.setMaxAge(20);
        fx.setAnimationTicks(20);
        renderer.addEffect(fx);
    }
}
 
开发者ID:ExoMagica,项目名称:ExoMagica,代码行数:16,代码来源:RitualBasic.java

示例7: addLandingEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SideOnly (Side.CLIENT)
public static void addLandingEffects(World world, BlockPos pos, IBlockState state, Vector3 entityPos, int numParticles) {
    //Speshal raytrace, from feet to, down.
    Vector3 start = entityPos.copy();
    Vector3 end = start.copy().add(Vector3.down.copy().multiply(4));
    RayTraceResult traceResult = world.rayTraceBlocks(start.vec3(), end.vec3(), true, false, true);

    if (traceResult != null && traceResult.typeOfHit == Type.BLOCK) {
        ParticleManager manager = Minecraft.getMinecraft().effectRenderer;
        Random randy = new Random();
        BlockModelShapes modelProvider = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
        try {
            state = state.getActualState(world, pos);
        } catch (Throwable ignored) {
        }
        IBakedModel model = modelProvider.getModelForState(state);
        state = state.getBlock().getExtendedState(state, world, pos);
        if (model instanceof IModelParticleProvider) {
            Set<TextureAtlasSprite> hitSprites = ((IModelParticleProvider) model).getHitEffects(traceResult, state, world, pos);
            List<TextureAtlasSprite> sprites = hitSprites.stream().filter(sprite -> !ignoredParticleSprites.contains(sprite)).collect(Collectors.toList());

            double speed = 0.15000000596046448D;
            if (numParticles != 0) {
                for (int i = 0; i < numParticles; i++) {
                    double mX = randy.nextGaussian() * speed;
                    double mY = randy.nextGaussian() * speed;
                    double mZ = randy.nextGaussian() * speed;
                    manager.addEffect(DigIconParticle.newLandingParticle(world, entityPos.x, entityPos.y, entityPos.z, mX, mY, mZ, sprites.get(randy.nextInt(sprites.size()))));
                }
            }
        }
    }

}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:35,代码来源:CustomParticleHandler.java

示例8: addBlockHitEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SideOnly (Side.CLIENT)
public static void addBlockHitEffects(World world, Cuboid6 bounds, EnumFacing side, TextureAtlasSprite icon, ParticleManager particleManager) {
    float border = 0.1F;
    Vector3 diff = bounds.max.copy().subtract(bounds.min).add(-2 * border);
    diff.x *= world.rand.nextDouble();
    diff.y *= world.rand.nextDouble();
    diff.z *= world.rand.nextDouble();
    Vector3 pos = diff.add(bounds.min).add(border);

    if (side == EnumFacing.DOWN) {
        diff.y = bounds.min.y - border;
    }
    if (side == EnumFacing.UP) {
        diff.y = bounds.max.y + border;
    }
    if (side == EnumFacing.NORTH) {
        diff.z = bounds.min.z - border;
    }
    if (side == EnumFacing.SOUTH) {
        diff.z = bounds.max.z + border;
    }
    if (side == EnumFacing.WEST) {
        diff.x = bounds.min.x - border;
    }
    if (side == EnumFacing.EAST) {
        diff.x = bounds.max.x + border;
    }

    particleManager.addEffect(new DigIconParticle(world, pos.x, pos.y, pos.z, 0, 0, 0, icon).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
}
 
开发者ID:TheCBProject,项目名称:CodeChickenLib,代码行数:31,代码来源:CustomParticleHandler.java

示例9: spawnDigParticles

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
/**
 * Spawns the digging particles for a block, similarly to the normal block hit effect
 * particle. The intended use of this method is to override the block hit effects.
 * 
 * @param manager The EffectRenderer, used to render the particle effect.
 * @param state The BlockState for the block to render the breaking effect of.
 * @param world The World to spawn the particle effects in.
 * @param pos The position to spawn the particles at.
 * @param side The side offset for the effect.
 * @return boolean Whether or not the effect actually spawned.
 */
public static boolean spawnDigParticles (ParticleManager manager, IBlockState state, World world, BlockPos pos, EnumFacing side) {
    
    if (state != null && state.getRenderType() != EnumBlockRenderType.INVISIBLE) {
        
        final int x = pos.getX();
        final int y = pos.getY();
        final int z = pos.getZ();
        final float offset = 0.1F;
        final AxisAlignedBB bounds = state.getBoundingBox(world, pos);
        double xOffset = x + MMDLib.RANDOM.nextDouble() * (bounds.maxX - bounds.minX - offset * 2.0F) + offset + bounds.minX;
        double yOffset = y + MMDLib.RANDOM.nextDouble() * (bounds.maxY - bounds.minY - offset * 2.0F) + offset + bounds.minY;
        double zOffset = z + MMDLib.RANDOM.nextDouble() * (bounds.maxZ - bounds.minZ - offset * 2.0F) + offset + bounds.minZ;
        
        if (side == EnumFacing.DOWN)
            yOffset = y + bounds.minY - offset;
        
        else if (side == EnumFacing.UP)
            yOffset = y + bounds.maxY + offset;
        
        else if (side == EnumFacing.NORTH)
            zOffset = z + bounds.minZ - offset;
        
        else if (side == EnumFacing.SOUTH)
            zOffset = z + bounds.maxZ + offset;
        
        else if (side == EnumFacing.WEST)
            xOffset = x + bounds.minX - offset;
        
        else if (side == EnumFacing.EAST)
            xOffset = x + bounds.maxX + offset;
        
        manager.addEffect(new ParticleDiggingOpen(world, xOffset, yOffset, zOffset, 0.0D, 0.0D, 0.0D, state).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
    }
    
    return false;
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:MMDLib-old,代码行数:48,代码来源:ParticleUtils.java

示例10: spawnDigParticles

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
/**
 * Spawns the digging particles for a block, similarly to the normal block hit effect
 * particle. The intended use of this method is to override the block hit effects.
 *
 * @param manager The EffectRenderer, used to render the particle effect.
 * @param state The BlockState for the block to render the breaking effect of.
 * @param world The World to spawn the particle effects in.
 * @param pos The position to spawn the particles at.
 * @param side The side offset for the effect.
 * @return boolean Whether or not the effect actually spawned.
 */
@SideOnly(Side.CLIENT)
public static boolean spawnDigParticles (ParticleManager manager, IBlockState state, World world, BlockPos pos, EnumFacing side) {

    if (state != null && state.getRenderType() != EnumBlockRenderType.INVISIBLE) {

        final int x = pos.getX();
        final int y = pos.getY();
        final int z = pos.getZ();
        final float offset = 0.1F;
        final AxisAlignedBB bounds = state.getBoundingBox(world, pos);
        double xOffset = x + Constants.RANDOM.nextDouble() * (bounds.maxX - bounds.minX - offset * 2.0F) + offset + bounds.minX;
        double yOffset = y + Constants.RANDOM.nextDouble() * (bounds.maxY - bounds.minY - offset * 2.0F) + offset + bounds.minY;
        double zOffset = z + Constants.RANDOM.nextDouble() * (bounds.maxZ - bounds.minZ - offset * 2.0F) + offset + bounds.minZ;

        if (side == EnumFacing.DOWN) {
            yOffset = y + bounds.minY - offset;
        }
        else if (side == EnumFacing.UP) {
            yOffset = y + bounds.maxY + offset;
        }
        else if (side == EnumFacing.NORTH) {
            zOffset = z + bounds.minZ - offset;
        }
        else if (side == EnumFacing.SOUTH) {
            zOffset = z + bounds.maxZ + offset;
        }
        else if (side == EnumFacing.WEST) {
            xOffset = x + bounds.minX - offset;
        }
        else if (side == EnumFacing.EAST) {
            xOffset = x + bounds.maxX + offset;
        }

        manager.addEffect(new OpenParticleDigging(world, xOffset, yOffset, zOffset, 0.0D, 0.0D, 0.0D, state).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
    }

    return false;
}
 
开发者ID:Darkhax-Minecraft,项目名称:Bookshelf,代码行数:50,代码来源:ParticleUtils.java

示例11: addDestroyEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager manager)
{
    IBlockState blockState = world.getBlockState(pos);
    if(blockState.getBlock() != this)
    {
        // somehow got called for a different block
        if(blockState.getBlock() instanceof SuperBlock)
        {
            // if the block at given position is somehow also a SuperBlock, call particle handler for it
            ((SuperBlock)(blockState.getBlock())).addDestroyEffects(world, pos, manager);
        }
        else
        {
            // handle as a vanilla block
            return false;
        }
    }
    
    ModelState modelState = this.getModelStateAssumeStateIsCurrent(world.getBlockState(pos), world, pos, false);

    for (int j = 0; j < 4; ++j)
    {
        for (int k = 0; k < 4; ++k)
        {
            for (int l = 0; l < 4; ++l)
            {
                double d0 = ((double)j + 0.5D) / 4.0D;
                double d1 = ((double)k + 0.5D) / 4.0D;
                double d2 = ((double)l + 0.5D) / 4.0D;
                manager.addEffect((new ParticleDiggingSuperBlock(world, (double)pos.getX() + d0, (double)pos.getY() + d1, (double)pos.getZ() + d2, d0 - 0.5D, d1 - 0.5D, d2 - 0.5D,
                        blockState, modelState)).setBlockPos(pos));
            }
        }
    }

    return true;
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:40,代码来源:SuperBlock.java

示例12: addDestroyEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager effectRenderer) {
  if (lastHitIcon == null) {
    lastHitIcon = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes()
        .getTexture(ModObject.block_machine_base.getBlockNN().getDefaultState());
  }

  IBlockState state = world.getBlockState(pos);
  TextureAtlasSprite tex = lastHitIcon;
  if (state.getBlock() != this || tex == null) {
    return false;
  }
  state = state.getActualState(world, pos);
  int i = 4;
  for (int j = 0; j < i; ++j) {
    for (int k = 0; k < i; ++k) {
      for (int l = 0; l < i; ++l) {
        double d0 = pos.getX() + (j + 0.5D) / i;
        double d1 = pos.getY() + (k + 0.5D) / i;
        double d2 = pos.getZ() + (l + 0.5D) / i;
        ParticleDigging fx = (ParticleDigging) new ParticleDigging.Factory().createParticle(-1, world, d0, d1, d2, d0 - pos.getX() - 0.5D,
            d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, 0);
        fx.setBlockPos(pos);
        fx.setParticleTexture(tex);
        effectRenderer.addEffect(fx);
      }
    }
  }

  return true;
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:33,代码来源:BlockConduitBundle.java

示例13: addDestroyEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public static boolean addDestroyEffects(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull ParticleManager effectRenderer) {

  TextureAtlasSprite texture = null;
  IBlockState state = world.getBlockState(pos);
  if (state.getBlock() instanceof IPaintable) {
    IBlockState paintSource = ((IPaintable) state.getBlock()).getPaintSource(state, world, pos);
    if (paintSource != null) {
      texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes().getTexture(paintSource);
    }
  }
  if (texture == null) {
    texture = lastTexture;
    if (texture == null) {
      return false;
    }
  }

  int i = 4;
  for (int j = 0; j < i; ++j) {
    for (int k = 0; k < i; ++k) {
      for (int l = 0; l < i; ++l) {
        double d0 = pos.getX() + (j + 0.5D) / i;
        double d1 = pos.getY() + (k + 0.5D) / i;
        double d2 = pos.getZ() + (l + 0.5D) / i;
        ParticleDigging fx = (ParticleDigging) new ParticleDigging.Factory().createParticle(-1, world, d0, d1, d2, d0 - pos.getX() - 0.5D,
            d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, 0);
        fx.setBlockPos(pos);
        fx.setParticleTexture(texture);
        effectRenderer.addEffect(fx);
      }
    }
  }

  return true;
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:37,代码来源:PaintHelper.java

示例14: addHitEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
@Override
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager effectRenderer)
{
	BlockPos pos = target.getBlockPos();
	EnumFacing side = target.sideHit;
	IBlockState iblockstate = worldObj.getBlockState(pos);

	TextureAtlasSprite sprite = null;

	TileEntity tile = worldObj.getTileEntity(pos);
	if(Util.notNullAndInstanceOf(tile, TileEntityPipe.class)){
		TileEntityPipe pipe = ((TileEntityPipe)tile);
		sprite = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(pipe.getPipeType().getCoreTexture(pipe));

		CoverData data = pipe.getCoverData(side);
		if(data !=null && data.getBlockState() !=null){
			if(data.getBlockState().getBlock().addHitEffects(data.getBlockState(), new PipeWorldWrapper(worldObj, pos, side), target, effectRenderer)){
				return true;
			}
			sprite = RenderUtil.getTexture(data.getBlockState());
		}
		if(sprite == null){
			return false;
		}
	}

	if(iblockstate == null)return false;

	Block block = iblockstate.getBlock();

	if (block.getRenderType(iblockstate) != EnumBlockRenderType.INVISIBLE)
	{
		AxisAlignedBB blockBounds = block.getBoundingBox(iblockstate, new PipeWorldWrapper(worldObj, pos, side), pos);
		int i = pos.getX();
		int j = pos.getY();
		int k = pos.getZ();
		float f = 0.1F;
		double d0 = i + this.rand.nextDouble() * (blockBounds.maxX - blockBounds.minX - f * 2.0F) + f + blockBounds.minX;
		double d1 = j + this.rand.nextDouble() * (blockBounds.maxY - blockBounds.minY - f * 2.0F) + f + blockBounds.minY;
		double d2 = k + this.rand.nextDouble() * (blockBounds.maxZ - blockBounds.minZ - f * 2.0F) + f + blockBounds.minZ;

		if (side == EnumFacing.DOWN)
		{
			d1 = j + blockBounds.minY - f;
		}

		if (side == EnumFacing.UP)
		{
			d1 = j + blockBounds.maxY + f;
		}

		if (side == EnumFacing.NORTH)
		{
			d2 = k + blockBounds.minZ - f;
		}

		if (side == EnumFacing.SOUTH)
		{
			d2 = k + blockBounds.maxZ + f;
		}

		if (side == EnumFacing.WEST)
		{
			d0 = i + blockBounds.minX - f;
		}

		if (side == EnumFacing.EAST)
		{
			d0 = i + blockBounds.maxX + f;
		}
		ParticleDigging fx = (ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1,
				d2, 0, 0, 0, 0);
		fx.init().multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
		fx.setParticleTexture(sprite);
		effectRenderer.addEffect(fx);
		return true;
	}
	return super.addHitEffects(state, worldObj, target, effectRenderer);
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:82,代码来源:BlockPipe.java

示例15: addHitEffects

import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public boolean addHitEffects(IBlockState blockState, World world, RayTraceResult target, ParticleManager manager)
{
    if(blockState.getBlock() != this)
    {
        // somehow got called for a different block
        if(blockState.getBlock() instanceof SuperBlock)
        {
            // if the block at given position is somehow also a SuperBlock, call particle handler for it
            ((SuperBlock)(blockState.getBlock())).addHitEffects(blockState, world, target, manager);
        }
        else
        {
            // handle as a vanilla block
            return false;
        }
    }
    
    BlockPos pos = target.getBlockPos();
    ModelState modelState = this.getModelState(world, pos, false);
    
    EnumFacing side = target.sideHit;

    if (blockState.getRenderType() != EnumBlockRenderType.INVISIBLE)
    {
        int i = pos.getX();
        int j = pos.getY();
        int k = pos.getZ();
 
        AxisAlignedBB axisalignedbb = blockState.getBoundingBox(world, pos);
        double d0 = (double)i + ThreadLocalRandom.current().nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minX;
        double d1 = (double)j + ThreadLocalRandom.current().nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minY;
        double d2 = (double)k + ThreadLocalRandom.current().nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - 0.20000000298023224D) + 0.10000000149011612D + axisalignedbb.minZ;

        if (side == EnumFacing.DOWN)
        {
            d1 = (double)j + axisalignedbb.minY - 0.10000000149011612D;
        }

        if (side == EnumFacing.UP)
        {
            d1 = (double)j + axisalignedbb.maxY + 0.10000000149011612D;
        }

        if (side == EnumFacing.NORTH)
        {
            d2 = (double)k + axisalignedbb.minZ - 0.10000000149011612D;
        }

        if (side == EnumFacing.SOUTH)
        {
            d2 = (double)k + axisalignedbb.maxZ + 0.10000000149011612D;
        }

        if (side == EnumFacing.WEST)
        {
            d0 = (double)i + axisalignedbb.minX - 0.10000000149011612D;
        }

        if (side == EnumFacing.EAST)
        {
            d0 = (double)i + axisalignedbb.maxX + 0.10000000149011612D;
        }

        manager.addEffect((new ParticleDiggingSuperBlock(world, d0, d1, d2, 0.0D, 0.0D, 0.0D, blockState, modelState)).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F));
    }

    return true;
}
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:71,代码来源:SuperBlock.java


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