Format code [skip actions]

This commit is contained in:
github-actions 2023-09-02 05:48:12 +00:00
parent a49f37edb3
commit 9c25060c78
10 changed files with 49 additions and 41 deletions

View File

@ -48,7 +48,6 @@ import emu.grasscutter.game.quest.enums.QuestCond;
import emu.grasscutter.game.world.GroupReplacementData;
import emu.grasscutter.utils.Utils;
import it.unimi.dsi.fastutil.ints.*;
import java.lang.reflect.Field;
import java.util.*;
import javax.annotation.Nullable;
@ -281,7 +280,7 @@ public final class GameData {
@Getter
private static final Int2ObjectMap<HomeWorldAnimalData> homeWorldAnimalDataMap =
new Int2ObjectOpenHashMap<>();
new Int2ObjectOpenHashMap<>();
@Getter
private static final Int2ObjectMap<HomeWorldBgmData> homeWorldBgmDataMap =

View File

@ -13,10 +13,8 @@ import lombok.Getter;
public class EntityHomeAnimal extends EntityMonster implements Rebornable {
private int rebornCDTickCount;
private final Position rebornPos;
@Getter
private final int rebirth;
@Getter
private final int rebirthCD;
@Getter private final int rebirth;
@Getter private final int rebirthCD;
private boolean disappeared;
public EntityHomeAnimal(Scene scene, HomeWorldAnimalData data, Position pos) {
@ -28,8 +26,7 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable {
}
@Override
public void damage(float amount, int killerId, ElementType attackType) {
}
public void damage(float amount, int killerId, ElementType attackType) {}
@Override
public void onTick(int sceneTime) {
@ -44,8 +41,7 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable {
}
@Override
public void onCreate() {
}
public void onCreate() {}
@Override
public Position getRebornPos() {
@ -59,7 +55,10 @@ public class EntityHomeAnimal extends EntityMonster implements Rebornable {
@Override
public void onAiKillSelf() {
this.getScene().broadcastPacket(new PacketSceneEntityDisappearNotify(this, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE));
this.getScene()
.broadcastPacket(
new PacketSceneEntityDisappearNotify(
this, VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE));
this.rebornCDTickCount = this.getRebornCD();
this.disappeared = true;
}

View File

@ -31,12 +31,13 @@ public class HomeScene extends Scene {
}
@Override
public void setPaused(boolean paused) {
}
public void setPaused(boolean paused) {}
@Override
public void onTick() {
this.getEntities().values().forEach(gameEntity -> gameEntity.onTick(this.getSceneTimeSeconds()));
this.getEntities()
.values()
.forEach(gameEntity -> gameEntity.onTick(this.getSceneTimeSeconds()));
this.finishLoading();
this.checkPlayerRespawn();
@ -44,18 +45,14 @@ public class HomeScene extends Scene {
}
@Override
public void checkNpcGroup() {
}
public void checkNpcGroup() {}
@Override
public void checkSpawns() {
}
public void checkSpawns() {}
@Override
public void addItemEntity(int itemId, int amount, GameEntity bornForm) {
}
public void addItemEntity(int itemId, int amount, GameEntity bornForm) {}
@Override
public void loadNpcForPlayerEnter(Player player) {
}
public void loadNpcForPlayerEnter(Player player) {}
}

View File

@ -9,7 +9,6 @@ import emu.grasscutter.game.entity.EntityHomeAnimal;
import emu.grasscutter.game.world.Position;
import emu.grasscutter.game.world.Scene;
import emu.grasscutter.net.proto.HomeSceneArrangementInfoOuterClass.HomeSceneArrangementInfo;
import java.util.Collection;
import java.util.List;
import java.util.Map;
@ -80,15 +79,19 @@ public class HomeSceneItem {
public List<EntityHomeAnimal> getAnimals(Scene scene) {
return this.blockItems.values().stream()
.map(HomeBlockItem::getDeployAnimalList)
.flatMap(Collection::stream)
.filter(homeAnimalItem -> GameData.getHomeWorldAnimalDataMap().containsKey(homeAnimalItem.getFurnitureId()))
.map(homeAnimalItem -> {
return new EntityHomeAnimal(scene,
GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()),
homeAnimalItem.getSpawnPos());
})
.toList();
.map(HomeBlockItem::getDeployAnimalList)
.flatMap(Collection::stream)
.filter(
homeAnimalItem ->
GameData.getHomeWorldAnimalDataMap().containsKey(homeAnimalItem.getFurnitureId()))
.map(
homeAnimalItem -> {
return new EntityHomeAnimal(
scene,
GameData.getHomeWorldAnimalDataMap().get(homeAnimalItem.getFurnitureId()),
homeAnimalItem.getSpawnPos());
})
.toList();
}
public int calComfort() {

View File

@ -8,7 +8,6 @@ import emu.grasscutter.game.world.World;
import emu.grasscutter.net.packet.BasePacket;
import emu.grasscutter.net.proto.ChatInfoOuterClass;
import emu.grasscutter.server.game.GameServer;
import emu.grasscutter.server.packet.send.*;
import java.util.List;
import lombok.Getter;

View File

@ -41,7 +41,6 @@ import emu.grasscutter.server.packet.send.*;
import emu.grasscutter.server.scheduler.ServerTaskScheduler;
import emu.grasscutter.utils.objects.KahnsSort;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
@ -465,9 +464,11 @@ public class Scene {
GameEntity currentEntity = player.getTeamManager().getCurrentAvatarEntity();
List<GameEntity> entities =
this.getEntities().values().stream()
.filter(entity -> entity != currentEntity)
.filter(gameEntity -> !(gameEntity instanceof Rebornable rebornable) || !rebornable.isInCD())
.toList();
.filter(entity -> entity != currentEntity)
.filter(
gameEntity ->
!(gameEntity instanceof Rebornable rebornable) || !rebornable.isInCD())
.toList();
player.sendPacket(new PacketSceneEntityAppearNotify(entities, VisionType.VISION_TYPE_MEET));
}

View File

@ -42,7 +42,6 @@ import emu.grasscutter.server.event.types.ServerEvent;
import emu.grasscutter.server.scheduler.ServerTaskScheduler;
import emu.grasscutter.task.TaskMap;
import emu.grasscutter.utils.Utils;
import it.unimi.dsi.fastutil.ints.*;
import java.net.*;
import java.time.*;

View File

@ -11,7 +11,8 @@ import emu.grasscutter.server.game.GameSession;
public class HandlerEntityAiKillSelfNotify extends PacketHandler {
@Override
public void handle(GameSession session, byte[] header, byte[] payload) throws Exception {
var entityId = EntityAiKillSelfNotifyOuterClass.EntityAiKillSelfNotify.parseFrom(payload).getEntityId();
var entityId =
EntityAiKillSelfNotifyOuterClass.EntityAiKillSelfNotify.parseFrom(payload).getEntityId();
if (session.getPlayer().getScene().getEntityById(entityId) instanceof Rebornable rebornable) {
rebornable.onAiKillSelf();
}

View File

@ -32,7 +32,13 @@ public class HandlerHomeChangeEditModeReq extends PacketHandler {
if (!req.getIsEnterEditMode()) {
var scene = session.getPlayer().getScene();
scene.addEntities(session.getPlayer().getCurHomeWorld().getHome().getHomeSceneItem(scene.getId()).getAnimals(scene));
scene.addEntities(
session
.getPlayer()
.getCurHomeWorld()
.getHome()
.getHomeSceneItem(scene.getId())
.getAnimals(scene));
}
session.send(new PacketHomeChangeEditModeRsp(req.getIsEnterEditMode()));

View File

@ -18,7 +18,11 @@ public class HandlerHomeEnterEditModeFinishReq extends PacketHandler {
*/
var scene = session.getPlayer().getScene();
scene.removeEntities(scene.getEntities().values().stream().filter(gameEntity -> gameEntity instanceof EntityHomeAnimal).toList(), VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE);
scene.removeEntities(
scene.getEntities().values().stream()
.filter(gameEntity -> gameEntity instanceof EntityHomeAnimal)
.toList(),
VisionTypeOuterClass.VisionType.VISION_TYPE_REMOVE);
session.send(new PacketHomeEnterEditModeFinishRsp());
}