From 1d6a1cdf3b669e3cc4955e144d78a069c93a76b3 Mon Sep 17 00:00:00 2001 From: PurpleWolfMC Date: Wed, 10 Apr 2024 18:11:46 -0700 Subject: [PATCH] Launch Update - Make Particles match Origins - PlaySound --- .../factory/conditions/types/EntityConditions.java | 4 +--- .../dueris/genesismc/factory/powers/apoli/Launch.java | 10 +++++++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/origins/src/main/java/me/dueris/genesismc/factory/conditions/types/EntityConditions.java b/origins/src/main/java/me/dueris/genesismc/factory/conditions/types/EntityConditions.java index 3cc62f927..646bf2251 100644 --- a/origins/src/main/java/me/dueris/genesismc/factory/conditions/types/EntityConditions.java +++ b/origins/src/main/java/me/dueris/genesismc/factory/conditions/types/EntityConditions.java @@ -137,9 +137,7 @@ public void prep() { } return false; })); - register(new ConditionFactory(GenesisMC.apoliIdentifier("sprinting"), (condition, entity) -> { - return entity instanceof Player p && p.isSprinting(); - })); + register(new ConditionFactory(GenesisMC.apoliIdentifier("sprinting"), (condition, entity) -> entity instanceof CraftPlayer player && player.isSprinting())); register(new ConditionFactory(GenesisMC.apoliIdentifier("food_level"), (condition, entity) -> { String comparison = condition.get("comparison").toString(); int compare_to = Integer.parseInt(condition.get("compare_to").toString()); diff --git a/origins/src/main/java/me/dueris/genesismc/factory/powers/apoli/Launch.java b/origins/src/main/java/me/dueris/genesismc/factory/powers/apoli/Launch.java index dcf438d5a..0946ba9c7 100644 --- a/origins/src/main/java/me/dueris/genesismc/factory/powers/apoli/Launch.java +++ b/origins/src/main/java/me/dueris/genesismc/factory/powers/apoli/Launch.java @@ -1,5 +1,6 @@ package me.dueris.genesismc.factory.powers.apoli; +import me.dueris.calio.util.MiscUtils; import me.dueris.genesismc.GenesisMC; import me.dueris.genesismc.event.KeybindTriggerEvent; import me.dueris.genesismc.factory.CraftApoli; @@ -11,8 +12,12 @@ import me.dueris.genesismc.util.KeybindingUtils; import me.dueris.genesismc.util.Utils; import me.dueris.genesismc.util.entity.OriginPlayerAccessor; +import net.minecraft.core.particles.ParticleTypes; +import net.minecraft.server.level.ServerLevel; import org.bukkit.Particle; +import org.bukkit.craftbukkit.v1_20_R3.CraftWorld; import org.bukkit.craftbukkit.v1_20_R3.entity.CraftEntity; +import org.bukkit.craftbukkit.v1_20_R3.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -78,7 +83,10 @@ public void run() { setActive(p, power.getTag(), true); p.setVelocity(p.getVelocity().setY(0)); p.setVelocity(p.getVelocity().setY(speed)); - p.spawnParticle(Particle.CLOUD, p.getLocation(), 100); + ((CraftWorld) p.getWorld()).getHandle().sendParticles(ParticleTypes.CLOUD, p.getX(), p.getY(), p.getZ(), 8, ((CraftPlayer)p).getHandle().getRandom().nextGaussian(), 0.0D, ((CraftPlayer)p).getHandle().getRandom().nextGaussian(), 0.5); + if(power.containsInstance("sound")){ + p.getWorld().playSound(p, MiscUtils.parseSound(power.getString("sound")), 0.5F, 0.4F / (((CraftPlayer)p).getHandle().getRandom().nextFloat() * 0.4F + 0.8F)); + } setActive(p, power.getTag(), true); times[0]++; }