diff --git a/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java b/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java index c739c077e8b..26460c09bd3 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java +++ b/src/main/java/emu/grasscutter/game/home/HomeModuleManager.java @@ -41,12 +41,20 @@ public HomeModuleManager(HomeWorld homeWorld) { } public void tick() { + if (this.moduleId == 0) { + return; + } + this.outdoor.onTick(); this.indoor.onTick(); this.summonEvents.removeIf(HomeAvatarSummonEvent::isTimeOver); } public void refreshMainHouse() { + if (this.moduleId == 0) { + return; + } + this.indoor = this.homeWorld.getSceneById(this.homeWorld.getActiveIndoorSceneId()); } @@ -67,6 +75,7 @@ private void fireAllAvatarRewardEvent() { var suites = allBlockItems.stream() .map(HomeBlockItem::getSuiteList) + .filter(Objects::nonNull) .flatMap(Collection::stream) .distinct() .toList(); @@ -210,6 +219,10 @@ public HomeSceneItem getIndoorSceneItem() { } public void onSetModule() { + if (this.moduleId == 0) { + return; + } + this.outdoor.addEntities(this.getOutdoorSceneItem().getAnimals(this.outdoor)); this.indoor.addEntities(this.getIndoorSceneItem().getAnimals(this.indoor)); this.fireAllAvatarRewardEvent(); diff --git a/src/main/java/emu/grasscutter/game/home/HomeWorld.java b/src/main/java/emu/grasscutter/game/home/HomeWorld.java index 73718925fec..525da1be40f 100644 --- a/src/main/java/emu/grasscutter/game/home/HomeWorld.java +++ b/src/main/java/emu/grasscutter/game/home/HomeWorld.java @@ -29,6 +29,9 @@ public HomeWorld(GameServer server, Player owner) { @Override public boolean onTick() { + if (this.moduleManager == null) { + return false; + } this.moduleManager.tick(); if (this.getTickCount() % 10 == 0) {