本文整理了Java中net.minecraft.util.EnumParticleTypes
类的一些代码示例,展示了EnumParticleTypes
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EnumParticleTypes
类的具体详情如下:
包路径:net.minecraft.util.EnumParticleTypes
类名称:EnumParticleTypes
暂无
代码示例来源:origin: TeamLapen/Vampirism
public void setParticle(EnumParticleTypes particleIn) {
this.getDataManager().set(PARTICLE, particleIn.getParticleID());
}
代码示例来源:origin: TeamLapen/Vampirism
public EnumParticleTypes getParticle() {
return EnumParticleTypes.getParticleFromId(this.getDataManager().get(PARTICLE));
}
代码示例来源:origin: SleepyTrousers/EnderIO
void toBytes(ByteBuf buffer) {
buffer.writeFloat((float) posX);
buffer.writeFloat((float) posY);
buffer.writeFloat((float) posZ);
buffer.writeByte(count);
int size = particles.size();
buffer.writeByte(size);
for (EnumParticleTypes particle : particles) {
buffer.writeByte(particle.ordinal());
}
}
代码示例来源:origin: CyclopsMC/IntegratedDynamics
public static IAspectWrite<ValueTypeDouble.ValueDouble, ValueTypeDouble> createForParticle(final EnumParticleTypes particle) {
return AspectWriteBuilders.Effect.BUILDER_DOUBLE_PARTICLE.appendKind("particle").appendKind(particle.getParticleName().toLowerCase(Locale.ROOT))
.handle(input -> {
double velocity = input.getRight();
if (velocity < 0) {
return null;
}
IAspectProperties properties = input.getMiddle();
PartPos pos = input.getLeft().getTarget();
boolean force = properties.getValue(AspectWriteBuilders.Effect.PROP_FORCE).getRawValue();
double x = pos.getPos().getBlockPos().getX() + properties.getValue(AspectWriteBuilders.Effect.PROP_OFFSET_X).getRawValue();
double y = pos.getPos().getBlockPos().getY() + properties.getValue(AspectWriteBuilders.Effect.PROP_OFFSET_Y).getRawValue();
double z = pos.getPos().getBlockPos().getZ() + properties.getValue(AspectWriteBuilders.Effect.PROP_OFFSET_Z).getRawValue();
int numberOfParticles = properties.getValue(AspectWriteBuilders.Effect.PROP_PARTICLES).getRawValue();
double xDir = properties.getValue(AspectWriteBuilders.Effect.PROP_SPREAD_X).getRawValue();
double yDir = properties.getValue(AspectWriteBuilders.Effect.PROP_SPREAD_Y).getRawValue();
double zDir = properties.getValue(AspectWriteBuilders.Effect.PROP_SPREAD_Z).getRawValue();
int[] aint = new int[particle.getArgumentCount()];
for (int i = 0; i < aint.length; i++) {
aint[i] = 0;
}
((WorldServer) pos.getPos().getWorld()).spawnParticle(
particle, force, x, y, z, numberOfParticles,
xDir, yDir, zDir, velocity, aint);
return null;
}).buildWrite();
}
代码示例来源:origin: TeamLapen/Vampirism
if (this.world.isRemote) {
EnumParticleTypes enumParticleTypes = getParticle();
int[] aint = new int[enumParticleTypes.getArgumentCount()];
if (aint.length > 0) {
aint[0] = getParticleArgumentOne();
代码示例来源: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 addEntityBiodustFX(World world, double x, double y, double z) {
if (!shouldSpawnParticle(world)) {
return;
}
ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
Particle particle = effectRenderer.spawnEffectParticle(EnumParticleTypes.VILLAGER_HAPPY.ordinal(), x, y, z, 0, 0, 0);
if (particle != null) {
effectRenderer.addEffect(particle);
}
}
}
代码示例来源:origin: PrinceOfAmber/Cyclic
@Override
public IMessage onMessage(PacketParticleAtPosition message, MessageContext ctx) {
EntityPlayer player = ModCyclic.proxy.getClientPlayer();
if (ctx.side.isClient() && player != null) {
// http://www.minecraftforge.net/forum/index.php?topic=21195.0
//yes, this being null happened once
World world = player.getEntityWorld();
UtilParticle.spawnParticle(world, EnumParticleTypes.getParticleFromId(message.particle), message.x + 0.5, message.y, message.z + 0.5, message.count);
}
return null;
}
}
代码示例来源: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: SleepyTrousers/EnderIO
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));
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!