Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
ziqian zhang
Grasscutter
Commits
52da2c23
Commit
52da2c23
authored
Jun 24, 2022
by
KingRainbow44
Browse files
Add & implement `EntityMoveEvent`
parent
47f33533
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/main/java/emu/grasscutter/server/event/entity/EntityMoveEvent.java
0 → 100644
View file @
52da2c23
package
emu.grasscutter.server.event.entity
;
import
emu.grasscutter.game.entity.GameEntity
;
import
emu.grasscutter.net.proto.MotionStateOuterClass.MotionState
;
import
emu.grasscutter.server.event.types.EntityEvent
;
import
emu.grasscutter.utils.Position
;
public
final
class
EntityMoveEvent
extends
EntityEvent
{
private
final
Position
position
,
rotation
;
private
final
MotionState
motionState
;
public
EntityMoveEvent
(
GameEntity
entity
,
Position
position
,
Position
rotation
,
MotionState
motionState
)
{
super
(
entity
);
this
.
position
=
position
;
this
.
rotation
=
rotation
;
this
.
motionState
=
motionState
;
}
public
Position
getPosition
()
{
return
this
.
position
;
}
public
Position
getRotation
()
{
return
this
.
rotation
;
}
public
MotionState
getMotionState
()
{
return
this
.
motionState
;
}
}
src/main/java/emu/grasscutter/server/packet/recv/HandlerCombatInvocationsNotify.java
View file @
52da2c23
...
@@ -13,8 +13,11 @@ import emu.grasscutter.net.packet.PacketHandler;
...
@@ -13,8 +13,11 @@ import emu.grasscutter.net.packet.PacketHandler;
import
emu.grasscutter.net.proto.MotionInfoOuterClass.MotionInfo
;
import
emu.grasscutter.net.proto.MotionInfoOuterClass.MotionInfo
;
import
emu.grasscutter.net.proto.MotionStateOuterClass.MotionState
;
import
emu.grasscutter.net.proto.MotionStateOuterClass.MotionState
;
import
emu.grasscutter.net.proto.PlayerDieTypeOuterClass
;
import
emu.grasscutter.net.proto.PlayerDieTypeOuterClass
;
import
emu.grasscutter.server.event.entity.EntityMoveEvent
;
import
emu.grasscutter.server.event.game.ReceiveCommandFeedbackEvent
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.game.GameSession
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.server.packet.send.PacketEntityFightPropUpdateNotify
;
import
emu.grasscutter.utils.Position
;
@Opcodes
(
PacketOpcodes
.
CombatInvocationsNotify
)
@Opcodes
(
PacketOpcodes
.
CombatInvocationsNotify
)
public
class
HandlerCombatInvocationsNotify
extends
PacketHandler
{
public
class
HandlerCombatInvocationsNotify
extends
PacketHandler
{
...
@@ -41,11 +44,18 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
...
@@ -41,11 +44,18 @@ public class HandlerCombatInvocationsNotify extends PacketHandler {
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
// Move player
// Move player
MotionInfo
motionInfo
=
moveInfo
.
getMotionInfo
();
MotionInfo
motionInfo
=
moveInfo
.
getMotionInfo
();
MotionState
motionState
=
motionInfo
.
getState
();
// Call entity move event.
EntityMoveEvent
event
=
new
EntityMoveEvent
(
entity
,
new
Position
(
motionInfo
.
getPos
()),
new
Position
(
motionInfo
.
getRot
()),
motionState
);
event
.
call
();
entity
.
getPosition
().
set
(
motionInfo
.
getPos
());
entity
.
getPosition
().
set
(
motionInfo
.
getPos
());
entity
.
getRotation
().
set
(
motionInfo
.
getRot
());
entity
.
getRotation
().
set
(
motionInfo
.
getRot
());
entity
.
setLastMoveSceneTimeMs
(
moveInfo
.
getSceneTime
());
entity
.
setLastMoveSceneTimeMs
(
moveInfo
.
getSceneTime
());
entity
.
setLastMoveReliableSeq
(
moveInfo
.
getReliableSeq
());
entity
.
setLastMoveReliableSeq
(
moveInfo
.
getReliableSeq
());
MotionState
motionState
=
motionInfo
.
getState
();
entity
.
setMotionState
(
motionState
);
entity
.
setMotionState
(
motionState
);
session
.
getPlayer
().
getStaminaManager
().
handleCombatInvocationsNotify
(
session
,
moveInfo
,
entity
);
session
.
getPlayer
().
getStaminaManager
().
handleCombatInvocationsNotify
(
session
,
moveInfo
,
entity
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment