Search in sources :

Example 1 with ParticleS2CPacket

use of net.minecraft.network.packet.s2c.play.ParticleS2CPacket 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)

Aggregations

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