net.minecraft.world.World.spawnParticle()方法的使用及代码示例

x33g5p2x  于2022-02-02 转载在 其他  
字(10.6k)|赞(0)|评价(0)|浏览(161)

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

World.spawnParticle介绍

暂无

代码示例

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

@SideOnly(Side.CLIENT)
@Override
public void handleStatusUpdate(byte id) {
  if(id == 3) {
    for(int j = 0; j < 16; j++) {
      world.spawnParticle(EnumParticleTypes.ITEM_CRACK, posX, posY, posZ, Math.random() * 0.2 - 0.1, Math.random() * 0.25, Math.random() * 0.2 - 0.1, Item.getIdFromItem(ModItems.vineBall));
    }
  }
}

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

@Override
public boolean receiveClientEvent(int event, int param) {
  if(event == START_BURN_EVENT) {
    Entity e = getWorld().getEntityByID(param);
    if(e != null) {
      e.world.spawnParticle(EnumParticleTypes.SMOKE_LARGE, e.posX, e.posY + 0.1, e.posZ, 0.0D, 0.0D, 0.0D);
      e.world.spawnParticle(EnumParticleTypes.FLAME, e.posX, e.posY, e.posZ, 0.0D, 0.0D, 0.0D);
    }
    return true;
  } else {
    return super.receiveClientEvent(event, param);
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
  @SideOnly( Side.CLIENT )
  public void clientPacketData( final INetworkInfo network, final AppEngPacket packet, final EntityPlayer player )
  {
    final World world = AppEng.proxy.getWorld();
    world.spawnParticle( EnumParticleTypes.EXPLOSION_LARGE, this.x, this.y, this.z, 1.0D, 0.0D, 0.0D, new int[0] );
  }
}

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

@Override
public void onLivingUpdate() {
  super.onLivingUpdate();
  if(Math.random() < 0.1)
    for(int j = 0; j < 3; ++j) {
      double d10 = func_82214_u(j);
      double d2 = func_82208_v(j);
      double d4 = func_82213_w(j);
      world.spawnParticle(EnumParticleTypes.HEART, d10 + rand.nextGaussian() * 0.30000001192092896D, d2 + rand.nextGaussian() * 0.30000001192092896D, d4 + rand.nextGaussian() * 0.30000001192092896D, 0.0D, 0.0D, 0.0D);
    }
}

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

@Override
public void onDeath(@Nonnull DamageSource source) {
  super.onDeath(source);
  EntityLivingBase entitylivingbase = getAttackingEntity();
  if(entitylivingbase instanceof EntityPlayerMP && !anyWithArmor) {
    DopplegangerNoArmorTrigger.INSTANCE.trigger((EntityPlayerMP) entitylivingbase, this, source);
  }
  playSound(SoundEvents.ENTITY_GENERIC_EXPLODE, 20F, (1F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
  world.spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, posX, posY, posZ, 1D, 0D, 0D);
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
{
  if( this.isLevelEmitterOn() )
  {
    final AEPartLocation d = this.getSide();
    final double d0 = d.xOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
    final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
    final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
    world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
        new int[0] );
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

@Override
public void randomDisplayTick( final World world, final BlockPos pos, final Random r )
{
  if( this.isLevelEmitterOn() )
  {
    final AEPartLocation d = this.getSide();
    final double d0 = d.xOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
    final double d1 = d.yOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
    final double d2 = d.zOffset * 0.45F + ( r.nextFloat() - 0.5F ) * 0.2D;
    world.spawnParticle( EnumParticleTypes.REDSTONE, 0.5 + pos.getX() + d0, 0.5 + pos.getY() + d1, 0.5 + pos.getZ() + d2, 0.0D, 0.0D, 0.0D,
        new int[0] );
  }
}

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

@Override
public boolean receiveClientEvent(int event, int param) {
  if(event == EXPLODE_EFFECT_EVENT) {
    if(getWorld().isRemote && getWorld().getEntityByID(param) instanceof EntityTNTPrimed) {
      Entity e = getWorld().getEntityByID(param);
      for(int i = 0; i < 50; i++)
        Botania.proxy.sparkleFX(e.posX + Math.random() * 4 - 2, e.posY + Math.random() * 4 - 2, e.posZ + Math.random() * 4 - 2, 1F, (float) Math.random() * 0.25F, (float) Math.random() * 0.25F, (float) (Math.random() * 0.65F + 1.25F), 12);
      getWorld().spawnParticle(EnumParticleTypes.EXPLOSION_HUGE, e.posX, e.posY, e.posZ, 1D, 0D, 0D);
    }
    return true;
  } else {
    return super.receiveClientEvent(event, param);
  }
}

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

@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing par6, float par7, float par8, float par9) {
  TileEntity tile = world.getTileEntity(pos);
  if(tile instanceof TileTinyPotato) {
    ((TileTinyPotato) tile).interact(player, hand, player.getHeldItem(hand), par6);
    world.spawnParticle(EnumParticleTypes.HEART, pos.getX() + AABB.minX + Math.random() * (AABB.maxX - AABB.minX), pos.getY() + AABB.maxY, pos.getZ() + AABB.minZ + Math.random() * (AABB.maxZ - AABB.minZ), 0, 0 ,0);
  }
  return true;
}

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

@SideOnly(Side.CLIENT)
@Override
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random r) {
  if (state.getBlock() != this)
    return;
  AltGrassVariant variant = state.getValue(BotaniaStateProps.ALTGRASS_VARIANT);
  switch(variant) {
  case DRY:
    break;
  case GOLDEN:
    break;
  case VIVID:
    break;
  case SCORCHED:
    if(r.nextInt(80) == 0)
      world.spawnParticle(EnumParticleTypes.FLAME, pos.getX() + r.nextFloat(), pos.getY() + 1.1, pos.getZ() + r.nextFloat(), 0, 0, 0);
    break;
  case INFUSED:
    if(r.nextInt(100) == 0)
      Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 0F, 1F, 1F, r.nextFloat() * 0.2F + 1F, 5);
    break;
  case MUTATED:
    if(r.nextInt(100) == 0) {
      if(r.nextInt(100) > 25)
        Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 0F, 1F, r.nextFloat() * 0.2F + 1F, 5);
      else Botania.proxy.sparkleFX(pos.getX() + r.nextFloat(), pos.getY() + 1.05, pos.getZ() + r.nextFloat(), 1F, 1F, 0F, r.nextFloat() * 0.2F + 1F, 5);
    }
    break;
  }
}

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

world.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0.05, 0);
if(Math.random() > 0.9)
  world.spawnParticle(EnumParticleTypes.LAVA, pos.getX() + 0.5 + Math.random() * 0.4 - 0.2, pos.getY() + 1, pos.getZ() + 0.5 + Math.random() * 0.4 - 0.2, 0, 0.01, 0);

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

@Override
public boolean doParticles(IManaBurst burst, ItemStack stack) {
  EntityThrowable entity = (EntityThrowable) burst;
  ItemStack lens = burst.getSourceLens();
  String id = ItemNBTHelper.getString(lens, TAG_BLOCK_NAME, "minecraft:air");
  Block b = Block.getBlockFromName(id);
  int meta = ItemNBTHelper.getInt(lens, TAG_META, 0);
  entity.world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, entity.posX, entity.posY, entity.posZ, entity.motionX, entity.motionY, entity.motionZ, Block.getStateId(b.getStateFromMeta(meta)));
  return true;
}

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

double m = 0.1;
for(int i = 0; i < 3; i++)
  world.spawnParticle(EnumParticleTypes.FLAME, posX + r * (Math.random() - 0.5), posY + r * (Math.random() - 0.5), posZ + r * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5), m * (Math.random() - 0.5));

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

@Override
public void update() {
  if(rotating) {
    lastTickRotation = rotation;
    rotation = (rotation + anglePerTick) % 360;
    rotationTicks--;
    if(rotationTicks <= 0) {
      rotating = false;
      // done rotating, tell neighbors
      world.notifyNeighborsOfStateChange(getPos(), getBlockType(), false);
      for(EnumFacing e : EnumFacing.VALUES) {
        world.notifyNeighborsOfStateChange(getPos().offset(e), getBlockType(), false);
      }
    }
  } else rotation = side * 90;
  if(world.isRemote) {
    int amt = rotating ? 3 : Math.random() < 0.1 ? 1 : 0;
    double x = getPos().getX() + 0.5 + Math.cos((rotation + 90) / 180.0 * Math.PI) * 0.35;
    double y = getPos().getY() + 0.2;
    double z = getPos().getZ() + 0.5 + Math.sin((rotation + 90) / 180.0 * Math.PI) * 0.35;
    for(int i = 0; i < amt; i++)
      world.spawnParticle(EnumParticleTypes.REDSTONE, x, y, z, 0.0D, 0.0D, 0.0D);
  }
}

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

moving = 0F;
for(int x = 0; x < 2; x++)
  world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, getPos().getX() + Math.random(), getPos().getY() + Math.random(), getPos().getZ() + Math.random(), 0, 0, 0);

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

@Override
public void onUpdate() {
  super.onUpdate();
  if(ticksExisted % 5 == 0) {
    List<EntitySlime> slimes = supertile.getWorld().getEntitiesWithinAABB(EntitySlime.class, new AxisAlignedBB(supertile.getPos().add(-RANGE, -RANGE, -RANGE), supertile.getPos().add(RANGE + 1, RANGE + 1, RANGE + 1)));
    for(EntitySlime slime : slimes) {
      if(slime.getEntityData().getBoolean(TAG_WORLD_SPAWNED) && !slime.isDead) {
        int size = slime.getSlimeSize();
        int mul = (int) Math.pow(2, size);
        int mana = 1200 * mul;
        if(!slime.world.isRemote) {
          slime.setDead();
          slime.playSound(size > 1 ? SoundEvents.ENTITY_SLIME_SQUISH : SoundEvents.ENTITY_SMALL_SLIME_SQUISH, 1, 0.02F);
          this.mana = Math.min(getMaxMana(), this.mana + mana);
          sync();
        }
        for (int j = 0; j < mul * 8; ++j) {
          float f = slime.world.rand.nextFloat() * (float)Math.PI * 2.0F;
          float f1 = slime.world.rand.nextFloat() * 0.5F + 0.5F;
          float f2 = MathHelper.sin(f) * size * 0.5F * f1;
          float f3 = MathHelper.cos(f) * size * 0.5F * f1;
          float f4 = slime.world.rand.nextFloat() * size * 0.5F * f1;
          slime.world.spawnParticle(EnumParticleTypes.SLIME, slime.posX + f2, slime.getEntityBoundingBox().minY + f4, slime.posZ + f3, 0.0D, 0.0D, 0.0D);
        }
        break;
      }
    }
  }
}

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

@Nonnull
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, @Nonnull EnumHand hand) {
  RayTraceResult rtr = rayTrace(world, player, true);
  ItemStack stack = player.getHeldItem(hand);
  if(rtr == null)
    return ActionResult.newResult(EnumActionResult.PASS, stack);
  else {
    if(rtr.typeOfHit == net.minecraft.util.math.RayTraceResult.Type.BLOCK) {
      BlockPos pos = rtr.getBlockPos();
      if(!world.isBlockModifiable(player, pos))
        return ActionResult.newResult(EnumActionResult.PASS, stack);
      if(!player.canPlayerEdit(pos, rtr.sideHit, stack))
        return ActionResult.newResult(EnumActionResult.PASS, stack);
      IBlockState state = world.getBlockState(pos);
      Fluid fluid = FluidRegistry.lookupFluidForBlock(state.getBlock());
      boolean isFull = state.getBlock() instanceof BlockLiquid && state.getValue(BlockLiquid.LEVEL) == 0
          || state.getBlock() instanceof IFluidBlock && Math.abs(((IFluidBlock) state.getBlock()).getFilledPercentage(world, pos)) >= 1;
      if(fluid != null && isFull) {
        player.playSound(fluid.getFillSound(world, pos), 1.0f, 1.0f);
        world.setBlockToAir(pos);
        for(int x = 0; x < 5; x++)
          world.spawnParticle(EnumParticleTypes.EXPLOSION_NORMAL, pos.getX() + Math.random(), pos.getY() + Math.random(), pos.getZ() + Math.random(), 0, 0, 0);
        return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
      }
    }
    return ActionResult.newResult(EnumActionResult.PASS, stack);
  }
}

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

f3 += west_z * ( 0.3 * ox - 0.15 );
w.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );
w.spawnParticle( EnumParticleTypes.FLAME, f1, f2, f3, 0.0D, 0.0D, 0.0D, new int[0] );

代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2

this.world.spawnParticle( EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D );

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

if(burnTime > 0 && supertile.getWorld().rand.nextInt(10) == 0) {
  Vec3d offset = getWorld().getBlockState(getPos()).getOffset(getWorld(), getPos()).add(0.4, 0.7, 0.4);
  supertile.getWorld().spawnParticle(EnumParticleTypes.FLAME, supertile.getPos().getX() + offset.x + Math.random() * 0.2, supertile.getPos().getY() + offset.y, supertile.getPos().getZ() + offset.z + Math.random() * 0.2, 0.0D, 0.0D, 0.0D);

相关文章

微信公众号

最新文章

更多

World类方法