Skip to content

Commit

Permalink
feat: add particles to substitution
Browse files Browse the repository at this point in the history
  • Loading branch information
sekwah41 committed May 5, 2022
1 parent 752970a commit 69f580d
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

import com.sekwah.narutomod.abilities.Ability;
import com.sekwah.narutomod.capabilities.INinjaData;
import net.minecraft.core.particles.ParticleTypes;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.Vec3;

Expand Down Expand Up @@ -35,6 +37,14 @@ public void performServer(Player player, INinjaData ninjaData, int ticksActive)
if(loc != null) {
double distance = player.position().distanceTo(loc);
if(distance < 40 && player.level.dimension().location().equals(ninjaData.getSubstitutionDimension())) {
if(player.level instanceof ServerLevel serverLevel) {
serverLevel.sendParticles(ParticleTypes.CLOUD,
player.getX(),
player.getY() + (player.getBbHeight() / 2),
player.getZ(),
100,
0.5, 0.7, 0.5, 0);
}
player.teleportTo(loc.x, loc.y, loc.z);
ninjaData.setSubstitutionLoc(null, null);
}
Expand Down

0 comments on commit 69f580d

Please sign in to comment.