mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 08:56:04 +01:00
Introduce a simpler way to get the original owner of an EntityClientGadget
This commit is contained in:
@@ -35,6 +35,8 @@ public class EntityClientGadget extends EntityBaseGadget {
|
||||
private int ownerEntityId;
|
||||
private int targetEntityId;
|
||||
private boolean asyncLoad;
|
||||
|
||||
private int originalOwnerEntityId;
|
||||
|
||||
public EntityClientGadget(Scene scene, Player player, EvtCreateGadgetNotify notify) {
|
||||
super(scene);
|
||||
@@ -48,6 +50,14 @@ public class EntityClientGadget extends EntityBaseGadget {
|
||||
this.ownerEntityId = notify.getPropOwnerEntityId();
|
||||
this.targetEntityId = notify.getTargetEntityId();
|
||||
this.asyncLoad = notify.getIsAsyncLoad();
|
||||
|
||||
GameEntity owner = scene.getEntityById(this.ownerEntityId);
|
||||
if (owner instanceof EntityClientGadget ownerGadget) {
|
||||
this.originalOwnerEntityId = ownerGadget.getOriginalOwnerEntityId();
|
||||
}
|
||||
else {
|
||||
this.originalOwnerEntityId = this.ownerEntityId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,6 +89,10 @@ public class EntityClientGadget extends EntityBaseGadget {
|
||||
return this.asyncLoad;
|
||||
}
|
||||
|
||||
public int getOriginalOwnerEntityId() {
|
||||
return this.originalOwnerEntityId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDeath(int killerId) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user