mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-07 00:42:57 +08:00
refactor: replace lambda with method reference
This commit is contained in:
parent
8c35c89bf5
commit
870085fc91
@ -25,7 +25,7 @@ public class RewardPreviewData extends GameResource {
|
|||||||
Arrays.stream(this.previewItems)
|
Arrays.stream(this.previewItems)
|
||||||
.filter(d -> d.getId() > 0 && d.getCount() != null && !d.getCount().isEmpty())
|
.filter(d -> d.getId() > 0 && d.getCount() != null && !d.getCount().isEmpty())
|
||||||
.map(ItemParamStringData::toItemParamData)
|
.map(ItemParamStringData::toItemParamData)
|
||||||
.toArray(size -> new ItemParamData[size]);
|
.toArray(ItemParamData[]::new);
|
||||||
} else {
|
} else {
|
||||||
this.previewItemsArray = new ItemParamData[0];
|
this.previewItemsArray = new ItemParamData[0];
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package emu.grasscutter.game.props.ItemUseAction;
|
package emu.grasscutter.game.props.ItemUseAction;
|
||||||
|
|
||||||
|
import emu.grasscutter.data.excels.avatar.AvatarSkillDepotData;
|
||||||
import emu.grasscutter.game.avatar.Avatar;
|
import emu.grasscutter.game.avatar.Avatar;
|
||||||
import emu.grasscutter.game.props.ItemUseOp;
|
import emu.grasscutter.game.props.ItemUseOp;
|
||||||
import emu.grasscutter.game.systems.InventorySystem;
|
import emu.grasscutter.game.systems.InventorySystem;
|
||||||
@ -43,7 +44,7 @@ public class ItemUseGainAvatar extends ItemUseInt {
|
|||||||
int itemId =
|
int itemId =
|
||||||
Optional.ofNullable(params.player.getAvatars().getAvatarById(this.i))
|
Optional.ofNullable(params.player.getAvatars().getAvatarById(this.i))
|
||||||
.map(Avatar::getSkillDepot)
|
.map(Avatar::getSkillDepot)
|
||||||
.map(depot -> depot.getTalentCostItemId())
|
.map(AvatarSkillDepotData::getTalentCostItemId)
|
||||||
.orElse((this.i % 1000) + 100);
|
.orElse((this.i % 1000) + 100);
|
||||||
return params.player.getInventory().addItem(itemId);
|
return params.player.getInventory().addItem(itemId);
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class InventorySystem extends BaseGameSystem {
|
|||||||
} else {
|
} else {
|
||||||
avatarId =
|
avatarId =
|
||||||
Optional.ofNullable(GameData.getItemDataMap().get(id))
|
Optional.ofNullable(GameData.getItemDataMap().get(id))
|
||||||
.map(itemData -> itemData.getItemUseActions())
|
.map(ItemData::getItemUseActions)
|
||||||
.flatMap(
|
.flatMap(
|
||||||
actions ->
|
actions ->
|
||||||
actions.stream()
|
actions.stream()
|
||||||
|
Loading…
Reference in New Issue
Block a user