View difference between Paste ID: hvfPrJkH and nX7JBkaE
SHOW: | | - or go back to the newest paste.
1
package EmeraldsPlus.common.Items;
2
3
import java.util.Random;
4
5
import EmeraldsPlus.common.Blocks.EmeraldsPlusBlocks;
6
7
import net.minecraft.entity.player.EntityPlayer;
8
import net.minecraft.item.Item;
9
import net.minecraft.item.ItemStack;
10
import net.minecraft.util.StringTranslate;
11
import net.minecraft.world.World;
12
13
public class ItemCarrotPlacer extends Item
14
{
15
    public ItemCarrotPlacer(int i)
16
    {
17
        super(i);
18
        maxStackSize = 1;
19
        setMaxDamage(19);
20
    }
21
    public String getItemDisplayName(ItemStack par1ItemStack)
22
    {
23
        String var2 = ("\u00a76" + StringTranslate.getInstance().translateNamedKey(this.getLocalItemName(par1ItemStack))).trim();
24
        return var2;
25
    }
26
    @Override
27
    public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
28
    {
29
        if (par7 == 0)
30
        {
31
            --par5;
32
        }
33
34
        if (par7 == 1)
35
        {
36
            ++par5;
37
        }
38
39
        if (par7 == 2)
40
        {
41
            --par6;
42
        }
43
44
        if (par7 == 3)
45
        {
46
            ++par6;
47
        }
48
49
        if (par7 == 4)
50
        {
51
            --par4;
52
        }
53
54
        if (par7 == 5)
55
        {
56
            ++par4;
57
        }
58
59
        if (!par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack))
60
        {
61
            return false;
62
        }
63
        else
64
        {
65
            int var11 = par3World.getBlockId(par4, par5, par6);
66
67
            if (var11 == 0)
68
            {
69
                par3World.playSoundEffect(par4, par5, par6, "EmeraldsPlusF.ccp", 0.2F, 1.0F);
70
                par3World.setBlockWithNotify(par4, par5, par6, EmeraldsPlusBlocks.CarrotCake.blockID);
71
            }
72
            else
73
            {
74
                par3World.playSoundEffect(par4, par5, par6, "mob.wolf.bark", 0.8F, 5.0F);
75
            }
76
77
            par1ItemStack.damageItem(1, par2EntityPlayer);
78
            return true;
79
        }
80
    }
81
    public String getTextureFile()
82
    {
83
        return "/EmeraldsPlusF/EmeraldsPlus_Items.png";
84
    }
85
    public String Version()
86
    {
87
        return "1.4.7";
88
    }
89
}