Skip to content

Commit 680b7f5

Browse files
committed
chore: use empty ItemStacks where possible
W
1 parent 7d679e3 commit 680b7f5

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/spongepowered/common/event/SpongeCommonEventFactory.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ public static Optional<net.minecraft.world.level.Explosion> detonateExplosive(fi
664664
* @param frame
665665
* @return The item if it is to be spawned, null if to be ignored
666666
*/
667-
public static @Nullable ItemStack throwDropItemAndConstructEvent(final net.minecraft.world.entity.Entity entity, final double posX, final double posY,
667+
public static ItemStack throwDropItemAndConstructEvent(final net.minecraft.world.entity.Entity entity, final double posX, final double posY,
668668
final double posZ, final ItemStackSnapshot snapshot, final List<ItemStackSnapshot> original, final CauseStackManager.StackFrame frame) {
669669
final ItemStack item;
670670

@@ -675,10 +675,10 @@ public static Optional<net.minecraft.world.level.Explosion> detonateExplosive(fi
675675
ImmutableList.of(snapshot), original);
676676
SpongeCommon.post(dropEvent);
677677
if (dropEvent.isCancelled()) {
678-
return null;
678+
return ItemStack.EMPTY;
679679
}
680680
if (dropEvent.droppedItems().isEmpty()) {
681-
return null;
681+
return ItemStack.EMPTY;
682682
}
683683

684684
// SECOND throw the ConstructEntityEvent
@@ -687,12 +687,12 @@ public static Optional<net.minecraft.world.level.Explosion> detonateExplosive(fi
687687
frame.removeContext(EventContextKeys.SPAWN_TYPE);
688688
SpongeCommon.post(event);
689689
if (event.isCancelled()) {
690-
return null;
690+
return ItemStack.EMPTY;
691691
}
692692

693-
item = event.isCancelled() ? null : ItemStackUtil.fromSnapshotToNative(dropEvent.droppedItems().get(0));
693+
item = event.isCancelled() ? ItemStack.EMPTY : ItemStackUtil.fromSnapshotToNative(dropEvent.droppedItems().get(0));
694694
if (item == null) {
695-
return null;
695+
return ItemStack.EMPTY;
696696
}
697697
return item;
698698
}

0 commit comments

Comments
 (0)