Skip to content
AleXndrTheGr8st edited this page Dec 14, 2014 · 1 revision

Using SimpleBucket

Creates a bucket item, such as the Copper Bucket. Note that this won't include any methods that are already detailed in the SimpleItem wiki page.

Usage:

yourEmptyBucket = new SimpleBucket(Block block);

Where block is the "liquid" inside the bucket, such as Blocks.air, Blocks.flowing_water, Blocks.flowing_lava.

Customising Methods:

You can customise your item using the below methods. In most cases, they will be appended to your initialization code (above, see the example below).

  • setAsEmptyVariant():

Sets the bucket as an empty bucket (or containing Blocks.air).

yourEmptyBucket = new SimpleBucket(Blocks.air).modId("yourModId").setAsEmptyVariant();
  • setAsLavaVariant():

Sets the bucket as a lava bucket (or containing Blocks.flowing_lava).

yourLavaBucket = new SimpleBucket(Blocks.flowing_lava).modId("yourModId").setAsLavaVariant();
  • setAsWaterVariant():

Sets the bucket as a water bucket (or containing Blocks.flowing_water).

yourWaterBucket = new SimpleBucket(Blocks.flowing_water).modId("yourModId").setAsWaterVariant();
  • void setEmptyVairant(Item emptyBucket):

Sets the empty variant of the current bucket. Only use if the current bucket is not the empty variant (setAsEmptyVariant() has not been called). This does not append to the initialization, and should be called after all the bucket variants are initialized.

((SimpleBucket) yourWaterBucket).setEmptyVariant(yourEmptyBucket);
((SimpleBucket) yourLavaBucket).setEmptyVariant(yourEmptyBucket);
  • void setLavaVariant(Item lavaBucket):

Sets the lava variant of the current bucket. Only use if the current bucket is not the lava variant (setAsLavaVariant() has not been called). This does not append to the initialization, and should be called after all the bucket variants are initialized.

((SimpleBucket) yourEmptyBucket).setLavaVariant(yourLavaBucket);
  • void setWaterVariant(Item waterBucket):

Sets the water variant of the current bucket. Only use if the current bucket is not the water variant (setAsWaterVariant() has not been called). This does not append to the initialization, and should be called after all the bucket variants are initialized.

((SimpleBucket) yourEmptyBucket).setWaterVariant(yourWaterBucket);

Example:

yourEmptyBucket = new SimpleBucket(Blocks.air).modId("yourModId").setAsEmptyVariant().setUnlocalizedName("your_empty_bucket");
yourWaterBucket = new SimpleBucket(Blocks.flowing_water).modId("yourModId").setAsWaterVariant().setUnlocalizedName("your_water_bucket");
yourLavaBucket = new SimpleBucket(Blocks.flowing_lava).modId("yourModId").setAsLavaVariant().setUnlocalizedName("your_lava_bucket");

((SimpleBucket) yourWaterBucket).setEmptyVariant(yourEmptyBucket);
((SimpleBucket) yourLavaBucket).setEmptyVariant(yourEmptyBucket);
((SimpleBucket) yourEmptyBucket).setWaterVariant(yourWaterBucket);
((SimpleBucket) yourEmptyBucket).setLavaVariant(yourLavaBucket);

Note that you do not need to set the lava variant of the water bucket, and vice versa. This is because you cannot pick up lava in a water bucket without first emptying it, thus converting it to the empty bucket. The same is true for picking up lava in a water bucket.

Clone this wiki locally