本文整理汇总了Java中net.minecraft.client.particle.ParticleManager.spawnEffectParticle方法的典型用法代码示例。如果您正苦于以下问题:Java ParticleManager.spawnEffectParticle方法的具体用法?Java ParticleManager.spawnEffectParticle怎么用?Java ParticleManager.spawnEffectParticle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.client.particle.ParticleManager
的用法示例。
在下文中一共展示了ParticleManager.spawnEffectParticle方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: randomDisplayTick
import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@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);
}
}
}
}
示例2: playerTick
import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void playerTick(TickEvent.PlayerTickEvent tickEvent) {
EntityPlayer entity = tickEvent.player;
if (entity == null)
return;
World world = entity.world;
if (world == null || !world.isRemote)
return;
if (InteractionBWA.OBVIOUS_STORMS) {
ParticleManager particleManager = Minecraft.getMinecraft().effectRenderer;
Random random = world.rand;
BlockPos pos = entity.getPosition();
int radius = 16; //blocks
for (int i = 0; i < InteractionBWA.DUST_PARTICLES; i++) {
BlockPos posGround = pos.add(random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius);
if (!shouldStorm(world, posGround))
continue;
posGround = world.getHeight(posGround).down(); //Constant access whaaaat???
IBlockState stateGround = world.getBlockState(posGround);
Particle particleGround = particleManager.spawnEffectParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(), posGround.getX() + random.nextDouble(), posGround.getY() + 1.2, posGround.getZ() + random.nextDouble(), -0.5 - random.nextDouble() * 0.6, 0.0, 0.0, Block.getStateId(stateGround));
}
for (int i = 0; i < InteractionBWA.AIR_PARTICLES; i++) {
BlockPos posAir = pos.add(random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius, random.nextInt(radius * 2 + 1) - radius);
if (world.canSeeSky(posAir) && shouldStorm(world, posAir)) {
Particle particleAir = particleManager.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), posAir.getX() + random.nextDouble(), posAir.getY() + random.nextDouble(), posAir.getZ() + random.nextDouble(), -0.5 - random.nextDouble() * 0.6, 0.0, 0.0);
particleAir.setRBGColorF(1.0f, 1.0f, 1.0f);
}
}
}
if (InteractionBWA.OBVIOUS_SAND_STORMS) {
float epsilon = 0.001f;
if (Math.abs(currentDistance - desiredDistance) > epsilon)
currentDistance += (desiredDistance - currentDistance) * 0.2; //TODO: We can do better.
if (Math.abs(currentDistanceScale - desiredDistanceScale) > epsilon)
currentDistanceScale += (desiredDistanceScale - currentDistanceScale) * 0.2; //TODO: We can do better.
if (Math.abs(currentRed - desiredRed) > epsilon)
currentRed += (desiredRed - currentRed) * 0.2;
if (Math.abs(currentGreen - desiredGreen) > epsilon)
currentGreen += (desiredGreen - currentGreen) * 0.2;
if (Math.abs(currentBlue - desiredBlue) > epsilon)
currentBlue += (desiredBlue - currentBlue) * 0.2;
}
}
示例3: randomDisplayTick
import net.minecraft.client.particle.ParticleManager; //导入方法依赖的package包/类
@Override
public void randomDisplayTick(@Nonnull IBlockState bs, @Nonnull World world, @Nonnull BlockPos pos, @Nonnull Random rand) {
// If active, randomly throw some smoke around
if (isActive(world, pos)) {
TileEntity te = world.getTileEntity(pos);
EnumFacing facing = EnumFacing.SOUTH;
if (te instanceof AbstractMachineEntity) {
AbstractMachineEntity me = (AbstractMachineEntity) te;
facing = me.facing;
}
for (int j = 0; j < (isEnhanced ? 3 : 1); j++) {
boolean toTop = rand.nextBoolean();
float offsetA = rand.nextFloat(); // top:front<->back or side:bottom<->top
float offsetB = .5f + rand.nextFloat() * .2f - rand.nextFloat() * .2f; // right<->left
float startX = pos.getX(), startY = pos.getY(), startZ = pos.getZ();
if (toTop) {
startY += 0.95f;
switch (facing) {
case NORTH:
case SOUTH:
startX += offsetB;
startZ += offsetA;
break;
case EAST:
case WEST:
default:
startX += offsetA;
startZ += offsetB;
break;
}
} else {
boolean swap = rand.nextBoolean();
startY += offsetA;
switch (facing) {
case NORTH:
case SOUTH:
startX += offsetB;
startZ += swap ? 0.05f : 0.95f;
break;
case EAST:
case WEST:
default:
startX += swap ? 0.05f : 0.95f;
startZ += offsetB;
break;
}
}
for (int i = 0; i < (isEnhanced ? 5 : 2); i++) {
ParticleManager er = Minecraft.getMinecraft().effectRenderer;
Particle fx = er.spawnEffectParticle(EnumParticleTypes.SMOKE_NORMAL.getParticleID(), startX, startY, startZ, 0.0D, 0.0D, 0.0D);
if (fx != null && rand.nextFloat() > .75f) {
fx.setRBGColorF(1 - (rand.nextFloat() * 0.2f), 1 - (rand.nextFloat() * 0.1f), 1 - (rand.nextFloat() * 0.2f));
}
startX += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
startY += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
startZ += rand.nextFloat() * .1f - rand.nextFloat() * .1f;
}
}
}
}