This repository has been archived by the owner on Mar 10, 2021. It is now read-only.
forked from iguanaman/IguanaTweaksTConstruct
/
ClayBucket.java
56 lines (46 loc) · 1.78 KB
/
ClayBucket.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package iguanaman.iguanatweakstconstruct.claybuckets.items;
import iguanaman.iguanatweakstconstruct.claybuckets.IguanaItems;
import iguanaman.iguanatweakstconstruct.reference.Reference;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBucket;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
public class ClayBucket extends ItemBucket
{
private final boolean isHot;
public ClayBucket(Block contents, String name, String texture)
{
this(contents);
this.setUnlocalizedName(Reference.prefix(name));
this.setTextureName(Reference.resource(texture));
}
public ClayBucket(Block contents)
{
super(contents);
this.setContainerItem(iguanaman.iguanatweakstconstruct.claybuckets.IguanaItems.clayBucketFired);
if(contents == Blocks.flowing_lava)
isHot = true;
else
isHot = false;
}
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
ItemStack result = super.onItemRightClick(itemStack, world, player);
if(result.getItem() == Items.bucket) {
// bucket is destroyed if it's a hot fluid
if(isHot)
{
itemStack.stackSize--;
return itemStack;
}
return new ItemStack(IguanaItems.clayBucketFired);
}
// water/lava pickup is handled in the ClayBucketHandler
//if(result.getItem() == Items.water_bucket) return new ItemStack(IguanaItems.clayBucketWater);
//if(result.getItem() == Items.lava_bucket) return new ItemStack(IguanaItems.clayBucketLava);
return result;
}
}