Jump to content

(1.7.10) Liquid management


EmperorZelos

Recommended Posts

I am working on my own little simple mod, well simple for now. I have programming experience but not minecraft in great quantities.

 

I am attempting to create a block that is supposed to be fillable with water and I want it to be so that I right click on the block with a water bucket and it fills up (if there is room availiable). My issue is that I feel there oughta be some command within the minecraft code that deals with filling with fluid, I have tried looking through forge but to no avail, I might have simply missed it or am just stupid.

 

What would the command be? Is there one? If not suggestions how to implement it simply?

Link to comment
Share on other sites

I don't want to be a wisenose or anything of that sort but I would like to point some things out:

 

1. Minecraft has allready got a water bucket, and no, that wasn't added in the last update.

2. Have you tried looking at the classes of the bucket and waterblocks?

3. Have you tried looking at the classes of the bucket and waterblocks? (yes I typed this twice, go look at it!)

4. It's the same for any other block actually, it's just replacing the block with air.

Link to comment
Share on other sites

I don't want to be a wisenose or anything of that sort but I would like to point some things out:

Most of the things were not wisenose so no worries

 

1. Minecraft has allready got a water bucket, and no, that wasn't added in the last update.

I am not interested in the waterbucket persay only that you right click WITH a waterbucket on my block, which is a boiler, and water gets added to it.

 

2. Have you tried looking at the classes of the bucket and waterblocks?

3. Have you tried looking at the classes of the bucket and waterblocks? (yes I typed this twice, go look at it!)

This is a wee bti wisenosey but I have looked about at fluids and such to the best of my ability which might not contain ALL the possibilities, I am looking into the bucket more

 

Looking around some it seems possible to use the bucket stuff but I am not too certain how to expand it

 

4. It's the same for any other block actually, it's just replacing the block with air.

I must have been unclear and I apologise, the idea is that I got a bucket of water, rightclick on my boiler and in goes the water with a bucket replacing it.

Link to comment
Share on other sites

My apologies, I seems I misunderstood from my part as well.

If you want to show the water, have a look at the cauldron class, that does exactly that.

And generally it is just as simple as override the blockactived method, get the players currentitem selected in inventory and swap that item(the waterbucket) with a bucket.

To right my wrong, let me give you that little piece of code:

 

	 /**
     * Called upon block activation (right click on the block.)
     */
    @Override
    public boolean onBlockActivated(World parWorld, int parXCoordinate, int parYCoordinate, int parZCoordinate, EntityPlayer parPlayer, int par6, float par7, float par8, float par9)
    {
    	parPlayer.inventory.setInventorySlotContents(parPlayer.inventory.currentItem, new ItemStack(Item.bucketEmpty, 1));
        return false;
    }

 

This should do the job.

 

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.



×
×
  • Create New...

Important Information

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