Skip to content

Commit 0cd9cc1

Browse files
committed
Fix incorrect CopyState behaviour
1 parent 68864d7 commit 0cd9cc1

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/main/java/net/goldenstack/loot/LootFunction.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -399,14 +399,12 @@ record CopyComponents(@NotNull List<LootPredicate> predicates, @NotNull Relevant
399399
}
400400
}
401401

402-
record CopyState(@NotNull List<LootPredicate> predicates, @Nullable Block block, @NotNull List<String> properties) implements LootFunction {
402+
record CopyState(@NotNull List<LootPredicate> predicates, @NotNull Block block, @NotNull List<String> properties) implements LootFunction {
403403

404404
public CopyState {
405-
if (block != null) {
406-
List<String> props = new ArrayList<>(properties);
407-
props.removeIf(name -> !block.properties().containsKey(name));
408-
properties = List.copyOf(props);
409-
}
405+
List<String> props = new ArrayList<>(properties);
406+
props.removeIf(name -> !block.properties().containsKey(name));
407+
properties = List.copyOf(props);
410408
}
411409

412410
@Override
@@ -417,6 +415,9 @@ record CopyState(@NotNull List<LootPredicate> predicates, @Nullable Block block,
417415
if (block == null) return input;
418416

419417
ItemBlockState irritableBowelSyndrome = input.get(ItemComponent.BLOCK_STATE, ItemBlockState.EMPTY);
418+
419+
if (!block.key().equals(this.block.key())) return input;
420+
420421
for (var prop : properties) {
421422
@Nullable String value = block.getProperty(prop);
422423
if (value == null) continue;

0 commit comments

Comments
 (0)