diff --git a/src/main/java/com/jenny/magic/items/wands/WandBoost.java b/src/main/java/com/jenny/magic/items/wands/WandBoost.java index 5d37047..90f6614 100644 --- a/src/main/java/com/jenny/magic/items/wands/WandBoost.java +++ b/src/main/java/com/jenny/magic/items/wands/WandBoost.java @@ -1,6 +1,10 @@ package com.jenny.magic.items.wands; import com.jenny.magic.config.ConfigServer; +import com.jenny.magic.networking.networking; +import com.jenny.magic.networking.packets.EffectS2C; +import com.jenny.magic.particles.effects; +import net.minecraft.server.level.ServerLevel; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResultHolder; @@ -37,6 +41,9 @@ public class WandBoost extends BaseWand { @Override public void releaseUsing(@NotNull ItemStack itemStack, @NotNull Level level, @NotNull LivingEntity livingEntity, int pTimeLeft) { + if (!level.isClientSide) { + networking.sendToClose(new EffectS2C(effects.EFFECT.WAND_BOOST, livingEntity.position().add(0, 1, 0)), (ServerLevel) level); + } if (!ConfigServer.C_PREVENT_BREAKING.get() || itemStack.getMaxDamage() - itemStack.getDamageValue() > 1) { livingEntity.addDeltaMovement(directionPlayer(livingEntity).scale(getBoostPower(pTimeLeft))); itemStack.hurtAndBreak(1, livingEntity, (player) -> player.broadcastBreakEvent(player.getUsedItemHand())); diff --git a/src/main/java/com/jenny/magic/particles/effects.java b/src/main/java/com/jenny/magic/particles/effects.java index 744f98a..04de74f 100644 --- a/src/main/java/com/jenny/magic/particles/effects.java +++ b/src/main/java/com/jenny/magic/particles/effects.java @@ -16,6 +16,7 @@ public class effects { case SCROLL_TELEPORT_TARGET -> teleportTarget(origin); case SCROLL_BONEMEAL -> bonemeal(origin); case SCROLL_HEALTH -> health(origin); + case WAND_BOOST -> boost(origin); } } @@ -60,6 +61,14 @@ public class effects { } } + private static void boost(Vec3 v) { + Vec3 pos; + for (int i = 0; i < 10; i++) { + pos = randPos(0.5f).add(v); + level().addParticle(ParticleTypes.POOF, pos.x, pos.y, pos.z, 0, 0, 0); + } + } + public static Vec3 randPos(float maxDist) { return new Vec3( rng().nextFloat() * 2 - 1, @@ -100,6 +109,7 @@ public class effects { SCROLL_REPEL, SCROLL_WITHER, SCROLL_BONEMEAL, - WAND_VACUUM + WAND_VACUUM, + WAND_BOOST } }