mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-12-16 00:44:46 +01:00
feat: add more home mark point (#2323)
This commit is contained in:
@@ -4,12 +4,15 @@ import dev.morphia.annotations.Entity;
|
||||
import dev.morphia.annotations.Id;
|
||||
import emu.grasscutter.data.binout.HomeworldDefaultSaveData;
|
||||
import emu.grasscutter.net.proto.HomeBlockArrangementInfoOuterClass.HomeBlockArrangementInfo;
|
||||
import java.util.List;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.FieldDefaults;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@Entity
|
||||
@Data
|
||||
@Builder(builderMethodName = "of")
|
||||
@@ -77,6 +80,8 @@ public class HomeBlockItem {
|
||||
.setIsUnlocked(unlocked)
|
||||
.setComfortValue(calComfort());
|
||||
|
||||
this.reassignIfNull();
|
||||
|
||||
this.deployFurnitureList.forEach(f -> proto.addDeployFurniureList(f.toProto()));
|
||||
this.persistentFurnitureList.forEach(f -> proto.addPersistentFurnitureList(f.toProto()));
|
||||
this.deployAnimalList.forEach(f -> proto.addDeployAnimalList(f.toProto()));
|
||||
@@ -84,4 +89,26 @@ public class HomeBlockItem {
|
||||
|
||||
return proto.build();
|
||||
}
|
||||
|
||||
// TODO add more types (farm field and suite)
|
||||
public List<? extends HomeMarkPointProtoFactory> getMarkPointProtoFactories() {
|
||||
this.reassignIfNull();
|
||||
|
||||
return Stream.of(this.deployFurnitureList, this.persistentFurnitureList, this.deployNPCList).flatMap(Collection::stream).toList();
|
||||
}
|
||||
|
||||
public void reassignIfNull() {
|
||||
if (this.deployFurnitureList == null) {
|
||||
this.deployFurnitureList = List.of();
|
||||
}
|
||||
if (this.persistentFurnitureList == null) {
|
||||
this.persistentFurnitureList = List.of();
|
||||
}
|
||||
if (this.deployAnimalList == null) {
|
||||
this.deployAnimalList = List.of();
|
||||
}
|
||||
if (this.deployNPCList == null) {
|
||||
this.deployNPCList = List.of();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user