mirror of
https://github.com/Melledy/Grasscutter.git
synced 2024-11-22 09:56:57 +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() {
|
public void tick() {
|
||||||
|
if (this.moduleId == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.outdoor.onTick();
|
this.outdoor.onTick();
|
||||||
this.indoor.onTick();
|
this.indoor.onTick();
|
||||||
this.summonEvents.removeIf(HomeAvatarSummonEvent::isTimeOver);
|
this.summonEvents.removeIf(HomeAvatarSummonEvent::isTimeOver);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshMainHouse() {
|
public void refreshMainHouse() {
|
||||||
|
if (this.moduleId == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.indoor = this.homeWorld.getSceneById(this.homeWorld.getActiveIndoorSceneId());
|
this.indoor = this.homeWorld.getSceneById(this.homeWorld.getActiveIndoorSceneId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,6 +75,7 @@ public class HomeModuleManager {
|
|||||||
var suites =
|
var suites =
|
||||||
allBlockItems.stream()
|
allBlockItems.stream()
|
||||||
.map(HomeBlockItem::getSuiteList)
|
.map(HomeBlockItem::getSuiteList)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
.flatMap(Collection::stream)
|
.flatMap(Collection::stream)
|
||||||
.distinct()
|
.distinct()
|
||||||
.toList();
|
.toList();
|
||||||
@ -210,6 +219,10 @@ public class HomeModuleManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void onSetModule() {
|
public void onSetModule() {
|
||||||
|
if (this.moduleId == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.outdoor.addEntities(this.getOutdoorSceneItem().getAnimals(this.outdoor));
|
this.outdoor.addEntities(this.getOutdoorSceneItem().getAnimals(this.outdoor));
|
||||||
this.indoor.addEntities(this.getIndoorSceneItem().getAnimals(this.indoor));
|
this.indoor.addEntities(this.getIndoorSceneItem().getAnimals(this.indoor));
|
||||||
this.fireAllAvatarRewardEvent();
|
this.fireAllAvatarRewardEvent();
|
||||||
|
@ -29,6 +29,9 @@ public class HomeWorld extends World {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onTick() {
|
public boolean onTick() {
|
||||||
|
if (this.moduleManager == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
this.moduleManager.tick();
|
this.moduleManager.tick();
|
||||||
|
|
||||||
if (this.getTickCount() % 10 == 0) {
|
if (this.getTickCount() % 10 == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user