use of net.minecraft.particle.ParticleEffect in project beebuddy by queenofthebees.
the class BeeEntityMixin method tameEffect.
@Override
protected void tameEffect(byte status, CallbackInfo cbi) {
if (status == 6 || status == 7) {
ParticleEffect p = status == 7 ? ParticleTypes.HEART : ParticleTypes.SMOKE;
for (int i = 0; i < 7; i++) {
double d = this.random.nextGaussian() * 0.02;
double e = this.random.nextGaussian() * 0.02;
double f = this.random.nextGaussian() * 0.02;
this.world.addParticle(p, this.getParticleX(1.0D), this.getRandomBodyY() + 0.5D, this.getParticleZ(1.0D), d, e, f);
}
}
}
use of net.minecraft.particle.ParticleEffect in project ArmorStandEditor by Patbox.
the class ServerPlayerEntityMixin method showInvisible.
@Inject(method = "playerTick", at = @At("HEAD"))
private void showInvisible(CallbackInfo ci) {
try {
if (ConfigManager.getConfig().configData.holdingToolSpawnsParticles) {
tickTimer++;
if (tickTimer > 10 && this.getMainHandStack().getItem() == ConfigManager.getConfig().armorStandTool) {
tickTimer = 0;
List<ArmorStandEntity> armorStands = this.world.getEntitiesByClass(ArmorStandEntity.class, new Box(this.getBlockPos().add(10, 10, 10), this.getBlockPos().add(-10, -10, -10)), null);
ParticleEffect particleEffect = new DustParticleEffect(0.8f, 0.2f, 0.2f, 1f);
for (ArmorStandEntity armorStand : armorStands) {
this.networkHandler.sendPacket(new ParticleS2CPacket(particleEffect, false, armorStand.getX(), armorStand.getY() + armorStand.getHeight() / 2, armorStand.getZ(), 0.2f, 0.2f, 0.2f, 0.1f, 3));
}
List<ItemFrameEntity> itemFrames = this.world.getEntitiesByClass(ItemFrameEntity.class, new Box(this.getBlockPos().add(10, 10, 10), this.getBlockPos().add(-10, -10, -10)), null);
ParticleEffect particleEffect2 = new DustParticleEffect(0.2f, 0.8f, 0.2f, 1f);
for (ItemFrameEntity itemFrame : itemFrames) {
this.networkHandler.sendPacket(new ParticleS2CPacket(particleEffect2, false, itemFrame.getX(), itemFrame.getY() + itemFrame.getHeight() / 2, itemFrame.getZ(), 0.2f, 0.2f, 0.2f, 0.1f, 3));
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
use of net.minecraft.particle.ParticleEffect in project Biome-Makeover by Lemonszz.
the class S2C_DoEntityParticle method receive.
@Override
public void receive(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
int entityID = buf.readInt();
Entity entity = client.world.getEntityById(entityID);
if (entity == null)
return;
int particleID = buf.readInt();
ParticleEffect particleType = (ParticleEffect) Registry.PARTICLE_TYPE.get(particleID);
if (!(particleType instanceof ParticleEffect))
return;
int count = buf.readInt();
float offset = buf.readFloat();
float velX = buf.readFloat();
float velY = buf.readFloat();
float velZ = buf.readFloat();
client.execute(() -> {
Random random = client.world.random;
for (int i = 0; i < count; ++i) {
Box bb = entity.getBoundingBox();
double xx = RandomUtil.randomRange(bb.minX - offset, bb.maxX + offset);
double yy = RandomUtil.randomRange(bb.minY - offset, bb.maxY + offset);
double zz = RandomUtil.randomRange(bb.minZ - offset, bb.maxZ + offset);
client.world.addParticle(particleType, xx, yy, zz, velX, velY, velZ);
}
});
}
use of net.minecraft.particle.ParticleEffect in project Biome-Makeover by Lemonszz.
the class S2C_DoEntityParticleCentered method receive.
@Override
public void receive(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
int entityID = buf.readInt();
Entity entity = client.world.getEntityById(entityID);
if (entity == null)
return;
int particleID = buf.readInt();
ParticleEffect particleType = (ParticleEffect) Registry.PARTICLE_TYPE.get(particleID);
if (!(particleType instanceof ParticleEffect))
return;
int count = buf.readInt();
boolean varyY = buf.readBoolean();
float velX = buf.readFloat();
float velY = buf.readFloat();
float velZ = buf.readFloat();
client.execute(() -> {
for (int i = 0; i < count; ++i) {
Box bb = entity.getBoundingBox();
double xx = bb.getCenter().x;
double zz = bb.getCenter().z;
double yy;
if (varyY)
yy = RandomUtil.randomRange(bb.minY, bb.maxY);
else
yy = bb.minY;
client.world.addParticle(particleType, xx, yy, zz, velX, velY, velZ);
}
});
}
use of net.minecraft.particle.ParticleEffect in project Biome-Makeover by Lemonszz.
the class S2C_DoLightningEntityParticles method receive.
@Override
public void receive(MinecraftClient client, ClientPlayNetworkHandler handler, PacketByteBuf buf, PacketSender responseSender) {
int entityID = buf.readInt();
int count = buf.readInt();
client.execute(() -> {
Entity e = client.world.getEntityById(entityID);
if (e == null || !(e instanceof LivingEntity))
return;
Random random = ((LivingEntity) e).getRandom();
Vec3d entityPos = e.getPos();
ParticleEffect particleEffect = BMEffects.LIGHTNING_SPARK;
for (int i = 0; i < count; ++i) {
double speed = random.nextDouble() * 1.0D;
double ac = random.nextDouble() * Math.PI * 2.0D;
double xVel = ((Math.cos(ac) * speed) * 0.1D) / 10F;
double yVel = 0.01D + random.nextDouble() * 0.5D;
double zVel = ((Math.sin(ac) * speed) * 0.1D) / 10F;
Particle particle = ClientUtil.spawnParticle(particleEffect, particleEffect.getType().shouldAlwaysSpawn(), true, entityPos.x + xVel * 0.01D, entityPos.y + 0.3D, entityPos.z + zVel * 0.01D, xVel, yVel, zVel);
if (particle != null) {
particle.move((float) speed);
}
}
});
}
Aggregations