net.minecraft.util.EnumParticleTypes.getParticleID()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(13.3k)|赞(0)|评价(0)|浏览(58)

本文整理了Java中net.minecraft.util.EnumParticleTypes.getParticleID()方法的一些代码示例,展示了EnumParticleTypes.getParticleID()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EnumParticleTypes.getParticleID()方法的具体详情如下:
包路径:net.minecraft.util.EnumParticleTypes
类名称:EnumParticleTypes
方法名:getParticleID

EnumParticleTypes.getParticleID介绍

暂无

代码示例

代码示例来源:origin: TeamLapen/Vampirism

public void setParticle(EnumParticleTypes particleIn) {
  this.getDataManager().set(PARTICLE, particleIn.getParticleID());
}

代码示例来源:origin: SleepyTrousers/EnderIO

private void spawnParticles() {
 double startX = posX;
 double startY = posY;
 double startZ = posZ;
 double offsetScale = 0.8 * getScale();
 for (int i = 0; i < 2; i++) {
  double xOffset = offsetScale - rand.nextFloat() * offsetScale * 2;
  double yOffset = offsetScale / 3 + rand.nextFloat() * offsetScale / 3 * 2F;
  double zOffset = offsetScale - rand.nextFloat() * offsetScale * 2;
  Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), startX + xOffset, startY + yOffset,
    startZ + zOffset, 0.0D, 0.0D, 0.0D);
  if (fx != null) {
   fx.setRBGColorF(0.8f, 0.2f, 0.2f);
  }
 }
}

代码示例来源:origin: ForestryMC/ForestryMC

public static void addPortalFx(World world, BlockPos pos, Random rand) {
  if (!shouldSpawnParticle(world)) {
    return;
  }
  int j = rand.nextInt(2) * 2 - 1;
  int k = rand.nextInt(2) * 2 - 1;
  double xPos = (double) pos.getX() + 0.5D + 0.25D * (double) j;
  double yPos = (double) ((float) pos.getY() + rand.nextFloat());
  double zPos = (double) pos.getZ() + 0.5D + 0.25D * (double) k;
  double xSpeed = (double) (rand.nextFloat() * (float) j);
  double ySpeed = ((double) rand.nextFloat() - 0.5D) * 0.125D;
  double zSpeed = (double) (rand.nextFloat() * (float) k);
  ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
  Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.PORTAL.getParticleID(), xPos, yPos, zPos, xSpeed, ySpeed, zSpeed);
  if (particle != null) {
    effectRenderer.addEffect(particle);
  }
}

代码示例来源:origin: JurassiCraftTeam/JurassiCraft2

@SideOnly(Side.CLIENT)
private void spawnParticles() {
Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(
    EnumParticleTypes.CLOUD.getParticleID(), 
    this.posX + this.motionX / 4.0D, 
    this.posY + this.motionY / 4.0D, 
    this.posZ + this.motionZ / 4.0D, 
    -this.motionX / 20.0D, 
    -this.motionY / 20.0D + 0.2D, 
    -this.motionZ / 20.0D);
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@SideOnly(Side.CLIENT)
public void doMultiplayerSFX(@Nonnull EntityPlayer player) {
 SoundHelper.playSound(player.world, player, SoundRegistry.JUMP, 1.0f, player.world.rand.nextFloat() * 0.5f + 0.75f);
 Random rand = player.world.rand;
 for (int i = rand.nextInt(10) + 5; i >= 0; i--) {
  final double posX = player.posX + (rand.nextDouble() * 0.5 - 0.25);
  final double posY = player.posY - player.getYOffset();
  final double posZ = player.posZ + (rand.nextDouble() * 0.5 - 0.25);
  // Note: for EntityOtherPlayerMP the motion fields are not set and may contain garbage
  final double velX = ((player instanceof EntityOtherPlayerMP) ? 0 : player.motionX) + (rand.nextDouble() * 0.5 - 0.25);
  final double velY = ((player instanceof EntityOtherPlayerMP) ? 0 : (player.motionY / 2)) + (rand.nextDouble() * -0.5);
  final double velZ = ((player instanceof EntityOtherPlayerMP) ? 0 : player.motionZ) + (rand.nextDouble() * 0.5 - 0.25);
  Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.REDSTONE.getParticleID(), posX, posY, posZ, 1, 1, 1);
  ClientUtil.setParticleVelocity(fx, velX, velY, velZ);
  Minecraft.getMinecraft().effectRenderer.addEffect(NullHelper.notnullM(fx, "spawnEffectParticle() failed unexptedly"));
 }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@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);
 }
}

代码示例来源:origin: WayofTime/BloodMagic

@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager) {
  if (world.getBlockState(pos).getBlock() == this) {
    Random random = new Random();
    particleManager.spawnEffectParticle(EnumParticleTypes.REDSTONE.getParticleID(), pos.getX() + 0.5D + random.nextGaussian() / 8, pos.getY() + 0.5D, pos.getZ() + 0.5D + random.nextGaussian() / 8, 0, 0, 0);
  }
  return true;
}

代码示例来源:origin: ForestryMC/ForestryMC

public static void addEntityExplodeFX(World world, double x, double y, double z) {
  if (!shouldSpawnParticle(world)) {
    return;
  }
  ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
  Particle Particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.EXPLOSION_NORMAL.getParticleID(), x, y, z, 0, 0, 0);
  effectRenderer.addEffect(Particle);
}

代码示例来源:origin: Vazkii/Quark

@Override
public void update() {
  if(!world.isRemote || isFullBlock(pos.up()))
    return;
  
  BlockPos source = findChimneyEnd();
  int yDiff = source.getY() - pos.getY();
  for(int i = 0; i < yDiff - 1; i++) {
    float x = pos.getX() + 0.2F + world.rand.nextFloat() * 0.6F;
    float y = pos.getY() + world.rand.nextFloat() * (yDiff - 1) - 0.4F;
    float z = pos.getZ() + 0.2F + world.rand.nextFloat() * 0.6F;
    
    world.spawnAlwaysVisibleParticle(EnumParticleTypes.SMOKE_LARGE.getParticleID(), x, y, z, 0, 0, 0);
  }
  
  for(int i = 0; i < 6; i++) {
    float x = source.getX() + 0.2F + world.rand.nextFloat() * 0.6F;
    float y = source.getY() + world.rand.nextFloat() - 0.4F;
    float z = source.getZ() + 0.2F + world.rand.nextFloat() * 0.6F;
    
    world.spawnAlwaysVisibleParticle(EnumParticleTypes.SMOKE_LARGE.getParticleID(), x, y, z, 0, 0, 0);
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
 int x = pos.getX();
 int y = pos.getY();
 int z = pos.getZ();
 // If active, randomly throw some smoke around
 if (isActive(world, pos)) {
  float startX = x + 1.0F;
  float startY = y + 1.0F;
  float startZ = z + 1.0F;
  for (int i = 0; i < 2; i++) {
   float xOffset = -0.2F - rand.nextFloat() * 0.6F;
   float yOffset = -0.1F + rand.nextFloat() * 0.2F;
   float zOffset = -0.2F - rand.nextFloat() * 0.6F;
   Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), startX + xOffset, startY + yOffset,
     startZ + zOffset, 0.0D, 0.0D, 0.0D, 0);
   if (fx != null) {
    fx.setRBGColorF(0.2f, 0.2f, 0.8f);
    ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5);
   }
  }
 }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
 if (isActive(world, pos) && shouldDoWorkThisTick(world, pos, 5)) {
  float startX = pos.getX() + 1.0F;
  float startY = pos.getY() + 0.85F;
  float startZ = pos.getZ() + 1.0F;
  for (int i = 0; i < 1; i++) {
   float xOffset = -0.2F - rand.nextFloat() * 0.6F;
   float yOffset = -0.1F + rand.nextFloat() * 0.2F;
   float zOffset = -0.2F - rand.nextFloat() * 0.6F;
   Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), startX + xOffset, startY + yOffset,
     startZ + zOffset, 0.0D, 0.0D, 0.0D);
   if (fx != null) {
    fx.setRBGColorF(0.2f, 0.2f, 0.8f);
    ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5);
   }
  }
 }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
@SideOnly(Side.CLIENT)
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
 // Spit some "steam" out the spout
 TileVat te = getTileEntity(world, pos);
 if (te != null && te.isActive()) {
  float pX = pos.getX() + 0.5f;
  float pY = pos.getY() + 0.7f;
  float pZ = pos.getZ() + 0.5f;
  EnumFacing dir = te.getFacing();
  pX += 0.6f * dir.getFrontOffsetX();
  pZ += 0.6f * dir.getFrontOffsetZ();
  double velX = ((rand.nextDouble() * 0.075) + 0.025) * dir.getFrontOffsetX();
  double velZ = ((rand.nextDouble() * 0.075) + 0.025) * dir.getFrontOffsetZ();
  int num = rand.nextInt(4) + 2;
  for (int k = 0; k < num; k++) {
   ParticleManager er = Minecraft.getMinecraft().effectRenderer;
   Particle fx = er.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), pX, pY, pZ, 1, 1, 1, 0);
   if (fx != null) {
    fx.setRBGColorF(1 - (rand.nextFloat() * 0.2f), 1 - (rand.nextFloat() * 0.1f), 1 - (rand.nextFloat() * 0.2f));
    ClientUtil.setParticleVelocity(fx, velX, -0.06, velZ);
   }
  }
 }
}

代码示例来源:origin: ForestryMC/ForestryMC

public static void addEntityPotionFX(World world, double x, double y, double z, int color) {
  if (!shouldSpawnParticle(world)) {
    return;
  }
  float red = (color >> 16 & 255) / 255.0F;
  float green = (color >> 8 & 255) / 255.0F;
  float blue = (color & 255) / 255.0F;
  ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
  Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), x, y, z, 0, 0, 0);
  if (particle != null) {
    particle.setRBGColorF(red, green, blue);
    effectRenderer.addEffect(particle);
  }
}

代码示例来源:origin: PrinceOfAmber/Cyclic

public static void spawnParticlePacket(EnumParticleTypes particle, int dimension, double x, double y, double z) {
  ModCyclic.network.sendToAllAround(new PacketParticleAtPosition(new BlockPos(x, y, z), particle.getParticleID(), count), new TargetPoint(dimension, x, y, z, RANGE));
 }
}

代码示例来源:origin: CoFH/ThermalExpansion

protected void diffuseClient() {
  if (renderFluid == null) {
    return;
  }
  int radius = TFFluids.isSplashPotion(renderFluid) ? radiusSplash : TFFluids.isLingeringPotion(renderFluid) ? radiusLingering : radiusPotion;
  List<PotionEffect> effects = PotionUtils.getEffectsFromTag(renderFluid.tag);
  int color = PotionUtils.getPotionColorFromEffectList(effects);
  int x = pos.getX();
  float y = pos.getY() + 0.5F;
  int z = pos.getZ();
  for (int i = x - radius; i <= x + radius; i++) {
    for (int k = z - radius; k <= z + radius; k++) {
      world.spawnAlwaysVisibleParticle(EnumParticleTypes.SPELL_MOB.getParticleID(), i + world.rand.nextFloat(), y, k + world.rand.nextFloat(), (color >> 16 & 255) / 255.0F, (color >> 8 & 255) / 255.0F, (color & 255) / 255.0F);
    }
  }
}

代码示例来源:origin: SleepyTrousers/EnderIO

@Override
public IMessage onMessage(PacketXpTransferEffects message, MessageContext ctx) {
 EntityPlayer player = EnderIO.proxy.getClientPlayer();
 if (player != null) {
  int particleCount = 5;
  if (message.swing) {
   player.swingArm(EnumHand.MAIN_HAND);
   particleCount += 5;
  }
  BlockPos pos = BlockPos.fromLong(message.pos);
  for (int i = 0; i < particleCount; i++) {
   float xOffset = 0.1F - player.world.rand.nextFloat() * 1.2F;
   float yOffset = 0.1F - player.world.rand.nextFloat() * 1.2F;
   float zOffset = 0.1F - player.world.rand.nextFloat() * 1.2F;
   Particle fx = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.SPELL.getParticleID(), pos.getX() + xOffset,
     pos.getY() + yOffset, pos.getZ() + zOffset, 0.0D, 0.0D, 0.0D);
   if (fx != null) {
    fx.setRBGColorF(0.2f, 0.8f, 0.2f);
    ClientUtil.setParticleVelocityY(fx, ClientUtil.getParticleVelocityY(fx) * 0.5);
   }
  }
 }
 return null;
}

代码示例来源:origin: AlgorithmX2/Chisels-and-Bits

public boolean addBlockDestroyEffects(
    @Nonnull final World world,
    @Nonnull final BlockPos pos,
    IBlockState state,
    final ParticleManager effectRenderer )
{
  if ( !state.getBlock().isAir( state, world, pos ) )
  {
    state = state.getActualState( new HarvestWorld( state ), pos );
    final int StateID = ModUtil.getStateId( state );
    final int i = 4;
    for ( int j = 0; j < i; ++j )
    {
      for ( int k = 0; k < i; ++k )
      {
        for ( int l = 0; l < i; ++l )
        {
          final double d0 = pos.getX() + ( j + 0.5D ) / i;
          final double d1 = pos.getY() + ( k + 0.5D ) / i;
          final double d2 = pos.getZ() + ( l + 0.5D ) / i;
          effectRenderer.spawnEffectParticle( EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1, d2, d0 - pos.getX() - 0.5D, d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, StateID );
        }
      }
    }
  }
  return true;
}

代码示例来源:origin: TeamLapen/Vampirism

@Override
protected void entityInit() {
  this.getDataManager().register(COLOR, 0);
  this.getDataManager().register(RADIUS, 0.5F);
  this.getDataManager().register(HEIGHT, 0.5F);
  this.getDataManager().register(PARTICLE, EnumParticleTypes.SPELL_MOB.getParticleID());
  this.getDataManager().register(PARTICLE_ARGUMENT_ONE, 0);
  this.getDataManager().register(PARTICLE_ARGUMENT_TWO, 0);
  this.getDataManager().register(SPAWN_RATE, 1F);
}

代码示例来源:origin: Chisel-Team/Chisel

@SuppressWarnings("null")
  public void spawnCompletionFX(EntityPlayer player, ItemStack chisel, IBlockState source) {
    SoundUtil.playSound(player, getPos(), SoundUtil.getSound(player, chisel, source));
    if (chisel.isEmpty()) {
      getWorld().playSound(player, pos, SoundEvents.ENTITY_ITEM_BREAK, SoundCategory.BLOCKS, 0.8F, 0.8F + this.world.rand.nextFloat() * 0.4F);
    }
    int i = 3;
    float mid = i / 2f;
    for (int j = 0; j < i; ++j) {
      for (int k = 0; k < i; ++k) {
        for (int l = 0; l < i; ++l) {
          double vx = (mid - j) * 0.05;
          double vz = (mid - l) * 0.05;
          ((ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(
              EnumParticleTypes.BLOCK_CRACK.getParticleID(), 
              pos.getX() + 0.5, pos.getY() + 10/16D, pos.getZ() + 0.5, 
              vx, 0, vz,
              Block.getIdFromBlock(source.getBlock())))
          .setBlockPos(pos).setParticleTexture(Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(source).getParticleTexture());
        }
      }
    }
  }
}

代码示例来源:origin: Chisel-Team/Chisel

public static void addDestroyEffects(World world, BlockPos pos, IBlockState state) {
  state = state.getActualState(world, pos);
  int i = 4;
  
  TextureAtlasSprite texture = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(state).getParticleTexture();
  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;
        ((ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1, d2, d0 - pos.getX() - 0.5D,
            d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, Block.getIdFromBlock(state.getBlock()))).setBlockPos(pos).setParticleTexture(texture);
      }
    }
  }
}

相关文章