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

Returning fuel containers doesnt account for itemstack state #241

Open
EnderiumSmith opened this issue Jan 25, 2025 · 2 comments
Open

Returning fuel containers doesnt account for itemstack state #241

EnderiumSmith opened this issue Jan 25, 2025 · 2 comments

Comments

@EnderiumSmith
Copy link

When returning the container of a fuel, it uses the deprecated method with no itemstack parameter. This causes items with special dynamic fuel behavior to get deleted.

@Luke100000
Copy link
Owner

Can you link an example of proper usage please?

@EnderiumSmith
Copy link
Author

EnderiumSmith commented Jan 25, 2025

here is what i use in my code

            ItemStack container=ItemStack.EMPTY;
            if(inventory.getStackInSlot(2).hasCraftingRemainingItem()){
                container=inventory.getStackInSlot(2).getCraftingRemainingItem();
            }
            inventory.extractItem(2,1,false);
            if(!container.isEmpty()){
                container=inventory.insertItem(2,container,false);
                if(!container.isEmpty()){
                    Containers.dropItemStack(level, getBlockPos().getX(), getBlockPos().getY(),getBlockPos().getZ(),container);
                }
            }

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

No branches or pull requests

2 participants