mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-14 07:55:57 +01:00
feat: implement teapot suite (#2344)
* feat: implement teapot suite * fix: home animals, check respawn, etc * fix: NPE and cancel summon events * fix: forgot to send eventId also
This commit is contained in:
@@ -10,12 +10,14 @@ import emu.grasscutter.server.packet.send.PacketSceneEntityAppearNotify;
|
||||
import emu.grasscutter.server.packet.send.PacketSceneEntityDisappearNotify;
|
||||
import lombok.Getter;
|
||||
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
public class EntityHomeAnimal extends EntityMonster implements Rebornable {
|
||||
private int rebornCDTickCount;
|
||||
private final Position rebornPos;
|
||||
@Getter private final int rebirth;
|
||||
@Getter private final int rebirthCD;
|
||||
private boolean disappeared;
|
||||
private final AtomicBoolean disappeared = new AtomicBoolean();
|
||||
|
||||
public EntityHomeAnimal(Scene scene, HomeWorldAnimalData data, Position pos) {
|
||||
super(scene, GameData.getMonsterDataMap().get(data.getMonsterID()), pos, 1);
|
||||
@@ -60,13 +62,13 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable {
|
||||
new PacketSceneEntityDisappearNotify(
|
||||
this, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE));
|
||||
this.rebornCDTickCount = this.getRebornCD();
|
||||
this.disappeared = true;
|
||||
this.disappeared.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reborn() {
|
||||
if (this.disappeared) {
|
||||
this.disappeared = false;
|
||||
if (this.disappeared.get()) {
|
||||
this.disappeared.set(false);
|
||||
this.getPosition().set(this.getRebornPos());
|
||||
this.getScene().broadcastPacket(new PacketSceneEntityAppearNotify(this));
|
||||
}
|
||||
@@ -74,6 +76,6 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable {
|
||||
|
||||
@Override
|
||||
public boolean isInCD() {
|
||||
return this.disappeared;
|
||||
return this.disappeared.get();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user