use of net.minecraft.particle.ParticleEffect in project MCDungeonsWeapons by chronosacaria.
the class PersistentProjectileEntityMixin method changeParticles.
@Redirect(method = "tick", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;addParticle(Lnet/minecraft/particle/ParticleEffect;DDDDDD)V", ordinal = 0))
private void changeParticles(World world, ParticleEffect parameters, double x, double y, double z, double velocityX, double velocityY, double velocityZ) {
ItemStack sourceStack = dataTracker.get(ORIGIN_STACK);
double d = posContext.x;
double e = posContext.y;
double g = posContext.z;
// Check if the source bow has a preferred particle to display
if (!sourceStack.isEmpty() && sourceStack.getItem() instanceof McdwBow) {
McdwBow bow = (McdwBow) sourceStack.getItem();
ParticleEffect bowParticles = bow.getArrowParticles();
if (bowParticles != null) {
this.world.addParticle(bowParticles, this.getX() + d * (double) iteration / 4.0D, this.getY() + e * (double) iteration / 4.0D, this.getZ() + g * (double) iteration / 4.0D, -d, -e + 0.2D, -g);
return;
}
}
// Display default crit particles
this.world.addParticle(ParticleTypes.CRIT, this.getX() + d * (double) iteration / 4.0D, this.getY() + e * (double) iteration / 4.0D, this.getZ() + g * (double) iteration / 4.0D, -d, -e + 0.2D, -g);
}
use of net.minecraft.particle.ParticleEffect in project visuality by PinkGoosik.
the class HitParticleRegistry method reload.
public static void reload() {
ENTRIES.clear();
ArrayList<Entry> entries = new ArrayList<>();
VisualityMod.CONFIG.getStringsArray("hit_particles_entries").forEach(entry -> {
String[] args = entry.split("\\|");
EntityType<?> entity = getEntityFromString(args[0]);
ParticleEffect particle = getParticleFromString(args[1]);
if (entity != null && particle != null) {
entries.add(new Entry(entity, particle));
}
});
ENTRIES.addAll(entries);
}
use of net.minecraft.particle.ParticleEffect in project meteor-client by MeteorDevelopment.
the class ParticleTypeListSetting method parseImpl.
@Override
protected List<ParticleType<?>> parseImpl(String str) {
String[] values = str.split(",");
List<ParticleType<?>> particleTypes = new ArrayList<>(values.length);
try {
for (String value : values) {
ParticleType<?> particleType = parseId(Registry.PARTICLE_TYPE, value);
if (particleType instanceof ParticleEffect)
particleTypes.add(particleType);
}
} catch (Exception ignored) {
}
return particleTypes;
}
use of net.minecraft.particle.ParticleEffect in project Biome-Makeover by Lemonszz.
the class S2C_DoLightningBottleParticles method receive.
@Override
public void receive(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
final boolean doBottleBreak = buf.readBoolean();
BlockPos pos = buf.readBlockPos();
client.execute(() -> {
Vec3d dir = Vec3d.ofBottomCenter(pos);
Random random = client.world.random;
World world = client.world;
if (doBottleBreak) {
for (int i = 0; i < 8; ++i) {
world.addParticle(new ItemStackParticleEffect(ParticleTypes.ITEM, new ItemStack(BMItems.LIGHTNING_BOTTLE)), dir.x, dir.y, dir.z, random.nextGaussian() * 0.15D, random.nextDouble() * 0.2D, random.nextGaussian() * 0.15D);
}
world.playSound(null, pos, SoundEvents.ENTITY_SPLASH_POTION_BREAK, SoundCategory.NEUTRAL, 1.0F, random.nextFloat() * 0.1F + 0.9F);
}
ParticleEffect particleEffect = BMEffects.LIGHTNING_SPARK;
ParticlesMode mode = MinecraftClient.getInstance().options.particles;
int particleCount = mode == ParticlesMode.ALL ? 100 : mode == ParticlesMode.DECREASED ? 50 : 10;
for (int i = 0; i < particleCount; ++i) {
double direction = random.nextDouble() * 4.0D;
double ac = random.nextDouble() * Math.PI * 2.0D;
double xVel = (Math.cos(ac) * direction) * 0.1D;
double yVel = 0.01D + random.nextDouble() * 0.5D;
double zVel = (Math.sin(ac) * direction) * 0.1D;
Particle particle = ClientUtil.spawnParticle(particleEffect, particleEffect.getType().shouldAlwaysSpawn(), true, dir.x + xVel * 0.01D, dir.y + 0.3D, dir.z + zVel * 0.01D, xVel, yVel, zVel);
if (particle != null) {
particle.move((float) direction);
}
}
});
}
use of net.minecraft.particle.ParticleEffect in project Client by MatHax.
the class ParticleTypeListSetting method parseImpl.
@Override
protected List<ParticleType<?>> parseImpl(String str) {
String[] values = str.split(",");
List<ParticleType<?>> particleTypes = new ArrayList<>(values.length);
try {
for (String value : values) {
ParticleType<?> particleType = parseId(Registry.PARTICLE_TYPE, value);
if (particleType instanceof ParticleEffect)
particleTypes.add(particleType);
}
} catch (Exception ignored) {
}
return particleTypes;
}
Aggregations