package com.leisuretimedock.blasttravelreborn.mixin;

import com.leisuretimedock.blasttravelreborn.util.PlayerEntityDuck;
import net.minecraft.client.Minecraft;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(Player.class)
public abstract class PlayerEntityMixinClient extends LivingEntity implements PlayerEntityDuck {
	protected PlayerEntityMixinClient(EntityType<? extends LivingEntity> entityType, Level world) {
		super(entityType, world);
	}

	@Inject(method = "tick", at = @At("TAIL"))
	private void blasttravel$endTick(CallbackInfo ci) {
		var self = this;
		if (this.blasttravel$inCannonFlight() && self.level().isClientSide()) {
			Minecraft.getInstance().particleEngine.createParticle(ParticleTypes.CAMPFIRE_COSY_SMOKE,
					self.xo, self.yo, self.zo, 0, 0, 0);
		}
	}
}







