Jump to content

Problem with a self filling fluid capability item


nexoner

Recommended Posts

I'm currently trying to make an item that fills itself with fluid when clicked on entities, all the capability stuff works, the item works with tanks and whatnot, but I can't get it to fill itself for some reason, any help'd be appreciated

    @Override
    public InteractionResult interactLivingEntity(ItemStack pStack, Player pPlayer, LivingEntity pInteractionTarget, InteractionHand pUsedHand) {
        if (pInteractionTarget instanceof WitherSkeleton){
            WitherSkeleton entity = (WitherSkeleton) pInteractionTarget;

            pStack.getCapability(CapabilityFluidHandler.FLUID_HANDLER_ITEM_CAPABILITY).ifPresent(handler ->{
                handler.fill(new FluidStack(Fluids.WATER,500), IFluidHandler.FluidAction.EXECUTE);
            });

            spawnParticles(pPlayer.getLevel(),entity.getOnPos());
            entity.remove(Entity.RemovalReason.KILLED);
            return InteractionResult.SUCCESS;
        }
        return InteractionResult.FAIL;

    }

 

Link to comment
Share on other sites

Look at DyeItem.interactLivingEntity() or one of the other vanilla items for the correct pattern.

In particular pay attention to the use of isClientSide/sidedSuccess().

I think your code only modifies the capability on the client?

Edited by warjort

Boilerplate:

If you don't post your logs/debug.log we can't help you. For curseforge you need to enable the forge debug.log in its minecraft settings. You should also post your crash report if you have one.

If there is no error in the log file and you don't have a crash report then post the launcher_log.txt from the minecraft folder. Again for curseforge this will be in your curseforge/minecraft/Install

Large files should be posted to a file sharing site like https://gist.github.com  You should also read the support forum sticky post.

Link to comment
Share on other sites

So, when looking back at it, the problem seems to not be related with client side problems, I've tested with other things that require server side, I've added client side checks, and this still doesn't seem to work for some reason, only draining and filling of the tank are disfunctional

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Remove entity_texture_features_forge from your server - it is a client side only mod
    • I’m Tom, a software engineer from San Francisco. My journey with Bitcoin began in 2015 when I invested $10,000 purely out of curiosity. Over the years, that modest investment grew to over $500,000. I took great care in securing my assets, employing hardware wallets and adhering to all the best practices. However, one unfortunate evening, I became the victim of a highly sophisticated phishing attack. I received an email that appeared to be from my hardware wallet provider, urging me to update my firmware. The email was so convincingly crafted that I didn't think twice before following the instructions. Before I knew it, all my Bitcoin was gone.Devastated and feeling incredibly foolish, I started searching for solutions online. That’s when I stumbled upon Maestro Encrypter Financier. Their website was promising, filled with testimonials from people who had gone through similar experiences. Desperate, I decided to take a leap of faith and reached out to them.The team at Maestro Encrypter Financier was exceptionally professional. They guided me through the process, reassuring me at every step. It wasn't an instant fix; it took a few weeks of meticulous work, but they managed to track down the stolen Bitcoin and recover my funds. Throughout the process, they kept me informed and educated me on additional security measures, such as using multi-signature wallets and better recognizing phishing attempts. Thanks to Maestro Encrypter Financier, I recovered my $500,000. This ordeal taught me invaluable lessons in cybersecurity. I now employ even more rigorous security measures, including regularly updating my knowledge on phishing tactics and maintaining robust wallet security.If you ever find yourself in a similar situation, don't hesitate to contact Maestro Encrypter Financier . They are the real deal, and their expertise and dedication are unmatched. This experience, though harrowing, has made me more vigilant and better prepared to safeguard my digital assets. Maestro Encrypter Financier not only restored my Bitcoin but also my peace of mind. Reach out to them through email  maestroencrypter @ financier . com
    • Hey y'all, was trying to get up a modded server with a custom mod pack and I got everything in the server folder running but when I added the mods I got this crash log, any help. Thanks! Heres the crash log https://pastebin.com/wpqe0kXm
    • So, me and my friend are playing on 1.19.2 using a custom modpack with essential mod in because we don't want to pay for hosting (nor can we). At first, when creating a world it tells me "Data pack validation failed!" with the options to "Go back" or "Reset to default", and by pressing reset to default it loads my world correctly with all the mods it has installed. When I leave and try to get on the world again however, it tells me “Errors in currently selected data packs prevented the world from loading. You can either try to load it with only the vanilla data pack (“safe mode”) or go back to the title screen and fix it manually” and I'm not sure how to fix it manually. After checking the output logs I saw that parent kotlin is missing but it didn't fix anything which is weird, if needed I can provide the output logs.
  • Topics

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.