mirror of
https://github.com/Minestom/Minestom.git
synced 2024-12-28 12:07:42 +01:00
Start with the elytra implementation
This commit is contained in:
parent
6a712b33a0
commit
34d428be10
@ -595,6 +595,14 @@ public class LivingEntity extends Entity implements EquipmentHandler {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFlyingWithElytra() {
|
||||||
|
return this.entityMeta.isFlyingWithElytra();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFlyingWithElytra(boolean isFlying) {
|
||||||
|
this.entityMeta.setFlyingWithElytra(isFlying);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to change the {@code isDead} internal field.
|
* Used to change the {@code isDead} internal field.
|
||||||
*
|
*
|
||||||
|
@ -0,0 +1,12 @@
|
|||||||
|
package net.minestom.server.event.player;
|
||||||
|
|
||||||
|
import net.minestom.server.entity.Player;
|
||||||
|
import net.minestom.server.event.PlayerEvent;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class PlayerStartFlyingWithElytraEvent extends PlayerEvent {
|
||||||
|
|
||||||
|
public PlayerStartFlyingWithElytraEvent(@NotNull Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
}
|
@ -1,10 +1,7 @@
|
|||||||
package net.minestom.server.listener;
|
package net.minestom.server.listener;
|
||||||
|
|
||||||
import net.minestom.server.entity.Player;
|
import net.minestom.server.entity.Player;
|
||||||
import net.minestom.server.event.player.PlayerStartSneakingEvent;
|
import net.minestom.server.event.player.*;
|
||||||
import net.minestom.server.event.player.PlayerStartSprintingEvent;
|
|
||||||
import net.minestom.server.event.player.PlayerStopSneakingEvent;
|
|
||||||
import net.minestom.server.event.player.PlayerStopSprintingEvent;
|
|
||||||
import net.minestom.server.network.packet.client.play.ClientEntityActionPacket;
|
import net.minestom.server.network.packet.client.play.ClientEntityActionPacket;
|
||||||
|
|
||||||
public class EntityActionListener {
|
public class EntityActionListener {
|
||||||
@ -24,6 +21,9 @@ public class EntityActionListener {
|
|||||||
case STOP_SPRINTING:
|
case STOP_SPRINTING:
|
||||||
EntityActionListener.setSprinting(player, false);
|
EntityActionListener.setSprinting(player, false);
|
||||||
break;
|
break;
|
||||||
|
case START_FLYING_ELYTRA:
|
||||||
|
EntityActionListener.startFlyingElytra(player);
|
||||||
|
break;
|
||||||
// TODO do remaining actions
|
// TODO do remaining actions
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,4 +55,9 @@ public class EntityActionListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void startFlyingElytra(Player player) {
|
||||||
|
player.setFlyingWithElytra(true);
|
||||||
|
player.callEvent(PlayerStartFlyingWithElytraEvent.class, new PlayerStartFlyingWithElytraEvent(player));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user