• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ParticleDigging类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addBlockHitEffects

import net.minecraft.client.particle.ParticleDigging; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private void addBlockHitEffects(@Nonnull World world, @Nonnull ParticleManager effectRenderer, double xCoord, double yCoord, double zCoord,
    @Nonnull EnumFacing sideEnum, @Nonnull TextureAtlasSprite tex) {

  double d0 = xCoord;
  double d1 = yCoord;
  double d2 = zCoord;
  if (sideEnum.getAxis() != Axis.X) {
    d0 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }
  if (sideEnum.getAxis() != Axis.Y) {
    d1 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }
  if (sideEnum.getAxis() != Axis.Z) {
    d2 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
  }

  ParticleDigging digFX = (ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1,
      d2, 0, 0, 0, 0);
  if (digFX != null) {
    digFX.init().multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
    digFX.setParticleTexture(tex);
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:25,代码来源:BlockConduitBundle.java


示例2: addDestroyEffects

import net.minecraft.client.particle.ParticleDigging; //导入依赖的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


示例3: addDestroyEffects

import net.minecraft.client.particle.ParticleDigging; //导入依赖的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


示例4: addDestroyEffects

import net.minecraft.client.particle.ParticleDigging; //导入依赖的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


示例5: addHitEffects

import net.minecraft.client.particle.ParticleDigging; //导入依赖的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


示例6: addBlockHitEffects

import net.minecraft.client.particle.ParticleDigging; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
public static void addBlockHitEffects(@Nonnull World world, @Nonnull IBlockState realBlock, @Nonnull IBlockState paintBlock, @Nonnull BlockPos pos,
    @Nonnull EnumFacing side, @Nonnull ParticleManager effectRenderer) {
  int i = pos.getX();
  int j = pos.getY();
  int k = pos.getZ();
  float f = 0.1F;
  AxisAlignedBB axisalignedbb = realBlock.getBoundingBox(world, pos);
  double d0 = i + rand.nextDouble() * (axisalignedbb.maxX - axisalignedbb.minX - f * 2.0F) + f + axisalignedbb.minX;
  double d1 = j + rand.nextDouble() * (axisalignedbb.maxY - axisalignedbb.minY - f * 2.0F) + f + axisalignedbb.minY;
  double d2 = k + rand.nextDouble() * (axisalignedbb.maxZ - axisalignedbb.minZ - f * 2.0F) + f + axisalignedbb.minZ;

  switch (side) {
  case DOWN:
    d1 = j + axisalignedbb.minY - f;
    break;
  case UP:
    d1 = j + axisalignedbb.maxY + f;
    break;
  case NORTH:
    d2 = k + axisalignedbb.minZ - f;
    break;
  case SOUTH:
    d2 = k + axisalignedbb.maxZ + f;
    break;
  case WEST:
    d0 = i + axisalignedbb.minX - f;
    break;
  case EAST:
    d0 = i + axisalignedbb.maxX + f;
    break;
  }

  // this state sets the gravity and texture. this pos sets the lighting, so we better use our block pos
  Particle digFX = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), i, j, k, 0, 0, 0,
      Block.getStateId(paintBlock));
  if (digFX instanceof ParticleDigging) {
    // this pos sets the tint...wrongly
    ((ParticleDigging) digFX).setBlockPos(pos).multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
    // manually fixing the tint
    if (paintBlock.getBlock() == Blocks.GRASS) {
      digFX.setRBGColorF(0.6f, 0.6f, 0.6f);
    } else {
      int tint = Minecraft.getMinecraft().getBlockColors().colorMultiplier(paintBlock, world, pos, 0);
      float particleRed = 0.6f * (tint >> 16 & 255) / 255.0F;
      float particleGreen = 0.6f * (tint >> 8 & 255) / 255.0F;
      float particleBlue = 0.6f * (tint & 255) / 255.0F;
      digFX.setRBGColorF(particleRed, particleGreen, particleBlue);
    }
    /// and this is the pos we actually want the particle to be
    digFX.setPosition(d0, d1, d2);
    // and that's it, spawn my monkeys, spawn!
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:55,代码来源:PaintHelper.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ProjectedProcessor类代码示例发布时间:2022-05-23
下一篇:
Java Variable类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap