mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 03:05:34 +00:00
Fix home nulls (#2355)
* Add null checking * Sanity check for moduleManager
This commit is contained in:
parent
8de281d4da
commit
5fd31aece8
@ -41,12 +41,20 @@ public class HomeModuleManager {
|
||||
}
|
||||
|
||||
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 @@ public class HomeModuleManager {
|
||||
var suites =
|
||||
allBlockItems.stream()
|
||||
.map(HomeBlockItem::getSuiteList)
|
||||
.filter(Objects::nonNull)
|
||||
.flatMap(Collection::stream)
|
||||
.distinct()
|
||||
.toList();
|
||||
@ -210,6 +219,10 @@ public class HomeModuleManager {
|
||||
}
|
||||
|
||||
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();
|
||||
|
@ -29,6 +29,9 @@ public class HomeWorld extends World {
|
||||
|
||||
@Override
|
||||
public boolean onTick() {
|
||||
if (this.moduleManager == null) {
|
||||
return false;
|
||||
}
|
||||
this.moduleManager.tick();
|
||||
|
||||
if (this.getTickCount() % 10 == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user