mirror of
https://github.com/Minestom/Minestom.git
synced 2025-03-02 11:21:15 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
08015586a0
71
src/main/java/net/minestom/server/effects/Effects.java
Normal file
71
src/main/java/net/minestom/server/effects/Effects.java
Normal file
@ -0,0 +1,71 @@
|
||||
package net.minestom.server.effects;
|
||||
|
||||
/**
|
||||
* Effects available in Minecraft Vanilla
|
||||
*/
|
||||
public enum Effects {
|
||||
|
||||
DISPENSER_DISPENSES(1000),
|
||||
DISPENSER_FAILS_TO_DISPENSE(1001),
|
||||
DISPENSER_SHOOTS(1002),
|
||||
ENDER_EYE_LAUNCHED(1003),
|
||||
FIREWORK_SHOT(1004),
|
||||
IRON_DOOR_OPENED(1005),
|
||||
WOODEN_DOOR_OPENED(1006),
|
||||
WOODEN_TRAPDOOR_OPENED(1007),
|
||||
FENCE_GATE_OPENED(1008),
|
||||
FIRE_EXTINGUISHED(1009),
|
||||
PLAY_RECORD(1010),
|
||||
IRON_DOOR_CLOSED(1011),
|
||||
WOODEN_DOOR_CLOSED(1012),
|
||||
WOODEN_TRAPDOOR_CLOSED(1013),
|
||||
FENCE_GATE_CLOSED(1014),
|
||||
GHAST_WARNS(1015),
|
||||
GHAST_SHOOTS(1016),
|
||||
ENDERDRAGON_SHOOTS(1017),
|
||||
BLAZE_SHOOTS(1018),
|
||||
ZOMBIE_ATTACKS_WOOD_DOOR(1019),
|
||||
ZOMBIE_ATTACKS_IRON_DOOR(1020),
|
||||
ZOMBIE_BREAKS_WOOD_DOOR(1021),
|
||||
WITHER_BREAKS_BLOCK(1022),
|
||||
WITHER_SPAWNED(1023),
|
||||
WITHER_SHOOTS(1024),
|
||||
BAT_TAKES_OFF(1025),
|
||||
ZOMBIE_INFECTS(1026),
|
||||
ZOMBIE_VILLAGER_CONVERTED(1027),
|
||||
ENDER_DRAGON_DEATH(1028),
|
||||
ANVIL_DESTROYED(1029),
|
||||
ANVIL_USED(1030),
|
||||
ANVIL_LANDED(1031),
|
||||
PORTAL_TRAVEL(1032),
|
||||
CHORUS_FLOWER_GROWN(1033),
|
||||
CHORUS_FLOWER_DIED(1034),
|
||||
BREWING_STAND_BREWED(1035),
|
||||
IRON_TRAPDOOR_OPENED(1036),
|
||||
IRON_TRAPDOOR_CLOSED(1037),
|
||||
|
||||
// Particles
|
||||
|
||||
SPAWNS_10_SMOKE_PARTICLES(2000),
|
||||
BLOCK_BREAK(2001),
|
||||
SPLASH_POTION(2002),
|
||||
EYE_OF_ENDER_ENTITY_BREAK_ANIMATION(2003),
|
||||
MOB_SPAWN_PARTICLE_EFFECT(2004),
|
||||
BONEMEAL_PARTICLES(2005),
|
||||
DRAGON_BREATH(2006),
|
||||
INSTANT_SPLASH(2007),
|
||||
|
||||
END_GATEWAY_SPAWN(3000),
|
||||
ENDERDRAGON_GROWL(3001),
|
||||
;
|
||||
|
||||
private int id;
|
||||
|
||||
Effects(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ import net.minestom.server.MinecraftServer;
|
||||
import net.minestom.server.bossbar.BossBar;
|
||||
import net.minestom.server.chat.Chat;
|
||||
import net.minestom.server.collision.BoundingBox;
|
||||
import net.minestom.server.effects.Effects;
|
||||
import net.minestom.server.entity.damage.DamageType;
|
||||
import net.minestom.server.entity.property.Attribute;
|
||||
import net.minestom.server.entity.vehicle.PlayerVehicleInformation;
|
||||
@ -426,6 +427,24 @@ public class Player extends LivingEntity {
|
||||
playerConnection.sendPacket(soundEffectPacket);
|
||||
}
|
||||
|
||||
/**
|
||||
* Plays a given effect at the given position for this player
|
||||
* @param effect the effect to play
|
||||
* @param x x position of the effect
|
||||
* @param y y position of the effect
|
||||
* @param z z position of the effect
|
||||
* @param data data for the effect
|
||||
* @param disableRelativeVolume disable volume scaling based on distance
|
||||
*/
|
||||
public void playEffect(Effects effect, int x, int y, int z, int data, boolean disableRelativeVolume) {
|
||||
EffectPacket packet = new EffectPacket();
|
||||
packet.effectId = effect.getId();
|
||||
packet.position = new BlockPosition(x, y, z);
|
||||
packet.data = data;
|
||||
packet.disableRelativeVolume = disableRelativeVolume;
|
||||
playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
public void stopSound() {
|
||||
StopSoundPacket stopSoundPacket = new StopSoundPacket();
|
||||
stopSoundPacket.flags = 0x00;
|
||||
|
Loading…
Reference in New Issue
Block a user