Skip to content

Fix elytra pickup issue causing immediate drop - #44

Merged
JannisHeydemann merged 3 commits into
masterfrom
dev
Oct 28, 2026
Merged

JannisHeydemann merged 3 commits into
masterfrom
dev

Conversation

@JannisHeydemann

Copy link
Copy Markdown
Owner

This pull request introduces new gameplay logic to prevent players from possessing Elytra items and refactors an existing mixin for clarity. The main focus is on removing Elytra from player inventories and equipment slots each server tick, as well as renaming the mixin class and updating its references for better maintainability.

Gameplay mechanics changes:

  • Added two ServerTickEvents.END_LEVEL_TICK listeners in TheJourneyMatters.java to (1) remove all Elytra items from player inventories and drop them, and (2) unequip Elytra from the chest slot and drop it if worn by any player.

Codebase refactoring:

  • Renamed the mixin class from TJMMixin to BlockItemMixin in BlockItemMixin.java for clearer intent and maintainability.
  • Updated the mixin registration in overworldinfrastructure.mixins.json to reference BlockItemMixin instead of TJMMixin.

Dependency updates:

  • Added necessary imports in TheJourneyMatters.java to support Elytra removal logic.

closes #3

…so works with the armor slot so u can't just use a Dispenser or equip it fast.
Copilot AI lite review requested due to automatic review settings October 23, 2026 11:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The Elytra cleanup logic does not reliably remove every Elytra, and required code documentation references remain outdated.

1 open issue
What changed in this PR

This pull request adds server-tick Elytra cleanup logic and renames the block-placement mixin for clarity.

Changes:

  • Adds listeners to remove and drop Elytras from inventories and chest equipment.
  • Renames TJMMixin to BlockItemMixin and updates mixin registration.
  • Adds supporting inventory and equipment imports.
File Review summary
src/​main/​resources/​overworldinfrastructure.mixins.json Registers the renamed BlockItemMixin.
src/​main/​java/​astro/​tjm/​TheJourneyMatters.java Adds Elytra cleanup listeners, but the current matching logic does not remove all Elytras, including damaged, enchanted, duplicate, or offhand items. The code documentation is also outdated.
src/​main/​java/​astro/​tjm/​mixin/​BlockItemMixin.java Renames the mixin class; the code documentation still references the removed TJMMixin name.

Review effort: Lite

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Two critical findings in TheJourneyMatters.java would stop the code from compiling because null is passed to Player#drop's primitive boolean parameter, and the second listener is redundant and would drop a duplicate stack.

3 open issues
1 previously missed issue

In code that hasn't changed since last review

Low severity Rename END_LEVEL_TICK parameter to world

src/​main/​java/​astro/​tjm/​TheJourneyMatters.java:58

The lambda parameter for END_LEVEL_TICK is a ServerLevel, not a server, so server is misleading. Rename it to world to match the existing listener in this file, and use world.players(). Line 58 also uses spaces instead of tabs, which the fix below corrects.

1 resolved since last review

Review effort: Lite

ItemStack stack = inventory.getItem(slot);
if (stack.getItem() == Items.ELYTRA) {
ItemStack extractedStack = inventory.removeItem(slot, stack.getCount());
player.drop(extractedStack, false, null);
Comment on lines +70 to +80

ServerTickEvents.END_LEVEL_TICK.register(server -> {
List<ServerPlayer> players = server.players();
for (ServerPlayer player : players) {
ItemStack chest = player.getItemBySlot(EquipmentSlot.CHEST);
if (chest.getItem().equals(Items.ELYTRA)) {
player.setItemSlot(EquipmentSlot.CHEST, ItemStack.EMPTY);
player.drop(new ItemStack(Items.ELYTRA), false, null);
}
}
});
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Unresolved critical findings remain, most notably passing null to a primitive boolean parameter in Player#drop, which would prevent compilation, along with a moderate issue where the wrong Elytra stack is dropped.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Remove unreachable chest-slot listener

src/​main/​java/​astro/​tjm/​TheJourneyMatters.java:80

This chest-slot listener never removes anything. Inventory#getContainerSize() includes the armor slots, so the first listener already removes and drops a worn Elytra before this one runs. Delete the block to keep the removal logic in one place. If it is kept, use == instead of .equals and drop the original chest stack instead of a new ItemStack.

1 resolved since last review

Review effort: Lite

@JannisHeydemann
JannisHeydemann merged commit 196438e into master Oct 28, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

decide on how to remove the elytra

2 participants