Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ default <E, V extends Value<E>> Optional<V> getValue(final Key<V> key) {
default Set<Key<?>> getKeys() {
return this.impl$delegateDataHolder().stream()
.flatMap(dh -> this.impl$getAllProviders(dh).stream()
.filter(provider -> provider.get(dh).isPresent()).map(DataProvider::key))
.map(DataProvider::key))
.filter(this::supports)
.collect(ImmutableSet.toImmutableSet());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ public class SpongeItemStackSnapshot implements ItemStackSnapshot {
private final int damageValue;
private final ImmutableList<DataManipulator.Immutable> manipulators;
private final transient ItemStack privateStack; // only for internal use since the processors have a huge say
private final ImmutableSet<Key<?>> keys;
private final ImmutableSet<org.spongepowered.api.data.value.Value.Immutable<?>> values;
private final Set<Key<?>> keys;
private final Set<org.spongepowered.api.data.value.Value.Immutable<?>> values;
private final DataComponentPatch components;
private @Nullable UUID creatorUniqueId;

Expand All @@ -95,17 +95,13 @@ public SpongeItemStackSnapshot(final ItemStack itemStack) {
this.itemType = itemStack.type();
this.quantity = itemStack.quantity();
final ImmutableList.Builder<DataManipulator.Immutable> builder = ImmutableList.builder();
final ImmutableSet.Builder<Key<?>> keyBuilder = ImmutableSet.builder();
final ImmutableSet.Builder<org.spongepowered.api.data.value.Value.Immutable<?>> valueBuilder = ImmutableSet.builder();
final DataManipulator.Mutable customData = ((SpongeDataHolderBridge) itemStack).bridge$getManipulator();
builder.add(customData.asImmutable());
keyBuilder.addAll(customData.getKeys());
valueBuilder.addAll(customData.getValues());
this.damageValue = ItemStackUtil.toNative(itemStack).getDamageValue();
this.manipulators = builder.build();
this.privateStack = itemStack.copy();
this.keys = keyBuilder.build();
this.values = valueBuilder.build();
this.keys = itemStack.getKeys();
this.values = itemStack.getValues();
this.components = ItemStackUtil.toNative(this.privateStack).getComponentsPatch();
}

Expand Down