-
Notifications
You must be signed in to change notification settings - Fork 755
/
SoilSlab.java
99 lines (89 loc) · 2.55 KB
/
SoilSlab.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
package tconstruct.blocks;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IIcon;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
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 SoilSlab extends SlabBase
{
public SoilSlab()
{
super(Material.field_151578_c);
this.setCreativeTab(TConstructRegistry.blockTab);
}
@Override
@SideOnly(Side.CLIENT)
public void registerIcons (IIconRegister iconRegister)
{
this.field_149761_L = iconRegister.registerIcon("tinker:grass_top");
}
@Override
@SideOnly(Side.CLIENT)
public IIcon getIcon (int side, int meta)
{
switch (meta % 8)
{
case 0:
return this.field_149761_L;//Block.grass.getIcon(1, 0);
case 1:
return Blocks.dirt.getIcon(side, 0);
case 2:
return Blocks.mycelium.getIcon(1, 0);
default:
return TRepo.craftedSoil.getIcon(side, meta - 3);
}
}
@Override
public void getSubBlocks (Block b, CreativeTabs tab, List list)
{
for (int iter = 0; iter < 8; iter++)
{
list.add(new ItemStack(b, 1, iter));
}
}
@Override
@SideOnly(Side.CLIENT)
public int getBlockColor ()
{
double d0 = 0.5D;
double d1 = 1.0D;
return ColorizerGrass.getGrassColor(d0, d1);
}
@Override
@SideOnly(Side.CLIENT)
public int getRenderColor (int par1)
{
//if (par1 % 8 == 0)
return this.getBlockColor();
//return 0xFFFFFF;
}
@Override
@SideOnly(Side.CLIENT)
public int colorMultiplier (IBlockAccess world, int x, int y, int z)
{
int l = 0;
int i1 = 0;
int j1 = 0;
for (int k1 = -1; k1 <= 1; ++k1)
{
for (int l1 = -1; l1 <= 1; ++l1)
{
int i2 = world.getBiomeGenForCoords(x + l1, z + k1).getBiomeGrassColor();
l += (i2 & 16711680) >> 16;
i1 += (i2 & 65280) >> 8;
j1 += i2 & 255;
}
}
return (l / 9 & 255) << 16 | (i1 / 9 & 255) << 8 | j1 / 9 & 255;
}
}