mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-13 17:04:24 +00:00
98 lines
2.5 KiB
Java
98 lines
2.5 KiB
Java
package tconstruct.blocks;
|
|||
|
|
|
||
|
|
import java.util.List;
|
||
|
|
|
||
|
|
import tconstruct.common.TContent;
|
||
|
|
import tconstruct.library.TConstructRegistry;
|
||
|
|
|
||
|
|
import net.minecraft.block.Block;
|
||
|
|
import net.minecraft.block.material.Material;
|
||
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||
|
|
import net.minecraft.creativetab.CreativeTabs;
|
||
|
|
import net.minecraft.item.ItemStack;
|
||
|
|
import net.minecraft.util.Icon;
|
||
|
|
import net.minecraft.world.ColorizerGrass;
|
||
|
|
import net.minecraft.world.IBlockAccess;
|
||
|
|
import cpw.mods.fml.relauncher.Side;
|
||
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
||
|
|
|
||
|
|
public class SoilSlab extends SlabBase
|
||
|
|
{
|
||
|
|
public SoilSlab(int id)
|
||
|
|
{
|
||
|
|
super(id, Material.ground);
|
||
|
|
this.setCreativeTab(TConstructRegistry.blockTab);
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
@SideOnly(Side.CLIENT)
|
||
|
|
public void registerIcons (IconRegister iconRegister)
|
||
|
|
{
|
||
|
|
this.blockIcon = iconRegister.registerIcon("tinker:grass_top");
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
@SideOnly(Side.CLIENT)
|
||
|
|
public Icon getIcon (int side, int meta)
|
||
|
|
{
|
||
|
|
switch (meta % 8)
|
||
|
|
{
|
||
|
|
case 0:
|
||
|
|
return this.blockIcon;//Block.grass.getIcon(1, 0);
|
||
|
|
case 1:
|
||
|
|
return Block.dirt.getIcon(side, 0);
|
||
|
|
case 2:
|
||
|
|
return Block.mycelium.getIcon(1, 0);
|
||
|
|
default:
|
||
|
|
return TContent.craftedSoil.getIcon(side, meta - 3);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
@Override
|
||
|
|
public void getSubBlocks (int id, CreativeTabs tab, List list)
|
||
|
|
{
|
||
|
|
for (int iter = 0; iter < 8; iter++)
|
||
|
|
{
|
||
|
|
list.add(new ItemStack(id, 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;
|
||
|
|
}
|
||
|
|
}
|