Skip to content

Commit

Permalink
Ignore PrepareBlockDropsTransaction when generating ChangeBlockEvent.All
Browse files Browse the repository at this point in the history
The transaction is used to associate the drops to block transaction
but it does not actually contain any relevant information about
the block change
  • Loading branch information
aromaa committed Sep 27, 2024
1 parent cf68907 commit 02f45e8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ public final Optional<ChangeBlockEvent.All> generateEvent(
final Map<BlockPos, BlockTransaction> eventTransactions = new HashMap<>();
for (final GameTransaction<@NonNull ?> transaction : transactions) {
final BlockEventBasedTransaction blockTransaction = (BlockEventBasedTransaction) transaction;
if (!blockTransaction.actualBlockTransaction()) {
continue;
}
final SpongeBlockSnapshot original = blockTransaction.getOriginalSnapshot();
final SpongeBlockSnapshot result = blockTransaction.getResultingSnapshot();
final Operation operation = context.getBlockOperation(original, result);
Expand All @@ -101,6 +104,10 @@ public final Optional<ChangeBlockEvent.All> generateEvent(
));
}

protected boolean actualBlockTransaction() {
return true;
}

protected abstract SpongeBlockSnapshot getResultingSnapshot();

protected abstract SpongeBlockSnapshot getOriginalSnapshot();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ public PrepareBlockDropsTransaction(
this.originalState = original;
}

@Override
protected boolean actualBlockTransaction() {
return false;
}

@Override
protected SpongeBlockSnapshot getResultingSnapshot() {
return null;
throw new UnsupportedOperationException();
}

@Override
Expand Down

0 comments on commit 02f45e8

Please sign in to comment.