-
Notifications
You must be signed in to change notification settings - Fork 754
/
SlimeLeaves.java
161 lines (136 loc) · 4.17 KB
/
SlimeLeaves.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
package tconstruct.blocks.slime;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.block.BlockLeaves;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.client.settings.GameSettings.Options;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import tconstruct.common.TContent;
import tconstruct.common.TRepo;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class SlimeLeaves extends BlockLeaves
{
private static final String[] fastLeaves = new String[] { "slimeleaves_blue_fast" };
private static final String[] fancyLeaves = new String[] { "slimeleaves_blue_fancy" };
@SideOnly(Side.CLIENT)
private IIcon[] fastIcons;
@SideOnly(Side.CLIENT)
private IIcon[] fancyIcons;
public SlimeLeaves()
{
super();
func_149647_a(TConstructRegistry.blockTab);
func_149713_g(1);
this.func_149711_c(0.3f);
}
@SideOnly(Side.CLIENT)
public int getBlockColor ()
{
return 0xffffff;
}
@SideOnly(Side.CLIENT)
public int getRenderColor (int par1)
{
return 0xffffff;
}
@SideOnly(Side.CLIENT)
public int colorMultiplier (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
{
return 0xffffff;
}
@SideOnly(Side.CLIENT)
@Override
public void func_149651_a (IIconRegister iconRegister)
{
this.fastIcons = new IIcon[fastLeaves.length];
this.fancyIcons = new IIcon[fancyLeaves.length];
for (int i = 0; i < this.fastIcons.length; i++)
{
this.fastIcons[i] = iconRegister.registerIcon("tinker:" + fastLeaves[i]);
this.fancyIcons[i] = iconRegister.registerIcon("tinker:" + fancyLeaves[i]);
}
}
@Override
@SideOnly(Side.CLIENT)
public IIcon func_149691_a (int side, int meta)
{
int tex = meta % 4;
if (Options.GRAPHICS.getEnumBoolean())
return fancyIcons[tex];
else
return fastIcons[tex];
}
@Override
public void func_149666_a (Item b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < fastIcons.length; iter++)
{
list.add(new ItemStack(b, 1, iter));
}
}
@Override
public boolean isLeaves (IBlockAccess world, int x, int y, int z)
{
return true;
}
/* Drops */
/**
* Returns the ID of the items to drop on destruction.
*/
public Item func_149650_a (int par1, Random par2Random, int par3)
{
return new ItemStack(TRepo.slimeSapling).getItem();
}
/**
* Drops the block items with a specified chance of dropping the specified items
*/
public void dropBlockAsItemWithChance (World world, int x, int y, int z, int meta, float chance, int fortune)
{
if (!world.isRemote)
{
int dropChance = 35;
/*if ((meta & 3) == 3)
{
j1 = 40;
}*/
if (fortune > 0)
{
dropChance -= 2 << fortune;
if (dropChance < 15)
{
dropChance = 15;
}
}
if (world.rand.nextInt(dropChance) == 0)
{
Item k1 = this.func_149650_a(meta, world.rand, fortune);
this.func_149642_a(world, x, y, z, new ItemStack(k1, 1, this.func_149692_a(meta)));
}
dropChance = 80;
if (fortune > 0)
{
dropChance -= 10 << fortune;
if (dropChance < 20)
{
dropChance = 20;
}
}
if ((meta & 3) == 0 && world.rand.nextInt(dropChance) == 0)
{
this.func_149642_a(world, x, y, z, new ItemStack(TRepo.strangeFood, 1, 0));
}
}
}
@Override
public String[] func_150125_e() {
return new String[]{"slime"};
}
}