Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched arguments for ItemStackedOnOtherEvent? #1797

Open
SiverDX opened this issue Dec 24, 2024 · 0 comments
Open

Switched arguments for ItemStackedOnOtherEvent? #1797

SiverDX opened this issue Dec 24, 2024 · 0 comments
Labels
triage Needs triaging and confirmation

Comments

@SiverDX
Copy link

SiverDX commented Dec 24, 2024

See https://discord.com/channels/313125603924639766/1249305774987939900/1300732536225402890
and https://discord.com/channels/313125603924639766/1249305774987939900/1262353590710829167

Original text:

is it intentional that these arguments are switched?

private boolean tryItemClickBehaviourOverride(Player player, ClickAction action, Slot slot, ItemStack clickedItem, ItemStack carriedItem) {
    // Neo: Fire the ItemStackedOnOtherEvent, and return true if it was cancelled (meaning the event was handled). Returning true will trigger the container to stop processing further logic.
    if (net.neoforged.neoforge.common.CommonHooks.onItemStackedOn(clickedItem, carriedItem, slot, action, player, createCarriedSlotAccess())) {
public static boolean onItemStackedOn(ItemStack carriedItem, ItemStack stackedOnItem, Slot slot, ClickAction action, Player player, SlotAccess carriedSlotAccess) {
    return NeoForge.EVENT_BUS.post(new ItemStackedOnOtherEvent(carriedItem, stackedOnItem, slot, action, player, carriedSlotAccess)).isCanceled();
}

when i click an armor item into a slot the carrieditem in the event is empty and the stackedonitem has the item
i'd assume the container hasn't been set yet, so it should be the other way around


The current 1.21.x still seems to have the problem

ItemStack itemstack9 = slot7.getItem();
ItemStack itemstack10 = this.getCarried();
player.updateTutorialInventoryAction(itemstack10, slot7.getItem(), clickaction);
if (!this.tryItemClickBehaviourOverride(player, clickaction, slot7, itemstack9, itemstack10)) {

The carried item is the second argument in the tryItemClickBehaviourOverride method and gets set as the second argument for the event
But the second argument for the event is the stacked-on item

@SiverDX SiverDX added the triage Needs triaging and confirmation label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs triaging and confirmation
Projects
None yet
Development

No branches or pull requests

1 participant