Search in sources :

Example 1 with DustParticleEffect

use of net.minecraft.particle.DustParticleEffect in project MCDoom by AzureDoom.

the class TotemEntity method tick.

public static void tick(World world, BlockPos pos, BlockState state, TotemEntity blockEntity) {
    if (blockEntity.world.getTime() % 80L == 0L) {
        blockEntity.applyEffects();
    }
    if (world != null) {
        if (world.isClient) {
            double d0 = (double) pos.getX() + 1.0D * (blockEntity.random.nextDouble() - 0.25D) * 2.0D;
            double d1 = (double) pos.getY() + 1.0D * (blockEntity.random.nextDouble() - 0.5D) * 2.0D;
            double d2 = (double) pos.getZ() + 1.0D * (blockEntity.random.nextDouble() - 0.25D) * 2.0D;
            for (int k = 0; k < 4; ++k) {
                world.addParticle(new DustParticleEffect(DustParticleEffect.RED, 1), d0, d1, d2, (blockEntity.random.nextDouble() - 0.5D) * 2.0D, -blockEntity.random.nextDouble(), (blockEntity.random.nextDouble() - 0.5D) * 2.0D);
            }
        }
    }
}
Also used : DustParticleEffect(net.minecraft.particle.DustParticleEffect)

Example 2 with DustParticleEffect

use of net.minecraft.particle.DustParticleEffect 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();
    }
}
Also used : DustParticleEffect(net.minecraft.particle.DustParticleEffect) ParticleEffect(net.minecraft.particle.ParticleEffect) ItemFrameEntity(net.minecraft.entity.decoration.ItemFrameEntity) DustParticleEffect(net.minecraft.particle.DustParticleEffect) Box(net.minecraft.util.math.Box) ParticleS2CPacket(net.minecraft.network.packet.s2c.play.ParticleS2CPacket) ArmorStandEntity(net.minecraft.entity.decoration.ArmorStandEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 3 with DustParticleEffect

use of net.minecraft.particle.DustParticleEffect in project FabricSecretRooms by Spaceman.

the class RedstoneChainBlock method randomDisplayTick.

@Override
@Environment(EnvType.CLIENT)
public void randomDisplayTick(BlockState state, World world, BlockPos pos, Random random) {
    if (random.nextInt(state.get(POWER) + 1) > 0) {
        double xPos = (double) pos.getX() + 0.5D;
        double yPos = (double) pos.getY() + random.nextDouble();
        double zPos = (double) pos.getZ() + 0.5D;
        world.addParticle(new DustParticleEffect(new Vec3f(1.0F, 0.0F, 0.0F), 0.5F), xPos, yPos, zPos, 0.0D, 0.0D, 0.0D);
    }
}
Also used : DustParticleEffect(net.minecraft.particle.DustParticleEffect) Vec3f(net.minecraft.util.math.Vec3f) Environment(net.fabricmc.api.Environment)

Aggregations

DustParticleEffect (net.minecraft.particle.DustParticleEffect)3 Environment (net.fabricmc.api.Environment)1 ArmorStandEntity (net.minecraft.entity.decoration.ArmorStandEntity)1 ItemFrameEntity (net.minecraft.entity.decoration.ItemFrameEntity)1 ParticleS2CPacket (net.minecraft.network.packet.s2c.play.ParticleS2CPacket)1 ParticleEffect (net.minecraft.particle.ParticleEffect)1 Box (net.minecraft.util.math.Box)1 Vec3f (net.minecraft.util.math.Vec3f)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1