Make the Plastic Barrier coloured.
Still no recipe, but I'm sure we'll get to that at some point.
This commit is contained in:
parent
4ea93a6fa1
commit
70ef6fb873
1 changed files with 47 additions and 0 deletions
|
@ -1,8 +1,20 @@
|
||||||
package mekanism.common.block;
|
package mekanism.common.block;
|
||||||
|
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import mekanism.api.EnumColor;
|
||||||
import mekanism.common.Mekanism;
|
import mekanism.common.Mekanism;
|
||||||
|
import mekanism.common.MekanismBlocks;
|
||||||
import net.minecraft.block.BlockFence;
|
import net.minecraft.block.BlockFence;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
import net.minecraft.creativetab.CreativeTabs;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.world.IBlockAccess;
|
||||||
|
import net.minecraft.world.World;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class BlockPlasticFence extends BlockFence
|
public class BlockPlasticFence extends BlockFence
|
||||||
{
|
{
|
||||||
|
@ -11,4 +23,39 @@ public class BlockPlasticFence extends BlockFence
|
||||||
super("mekanism:PlasticFence", Material.clay);
|
super("mekanism:PlasticFence", Material.clay);
|
||||||
setCreativeTab(Mekanism.tabMekanism);
|
setCreativeTab(Mekanism.tabMekanism);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@SideOnly(Side.CLIENT)
|
||||||
|
public void getSubBlocks(Item item, CreativeTabs creativetabs, List list)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < EnumColor.DYES.length; i++)
|
||||||
|
{
|
||||||
|
list.add(new ItemStack(item, 1, i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int colorMultiplier(IBlockAccess world, int x, int y, int z)
|
||||||
|
{
|
||||||
|
return getRenderColor(world.getBlockMetadata(x, y, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getRenderColor(int meta)
|
||||||
|
{
|
||||||
|
EnumColor colour = EnumColor.DYES[meta];
|
||||||
|
return (int)(colour.getColor(0)*255) << 16 | (int)(colour.getColor(1)*255) << 8 | (int)(colour.getColor(2)*255);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean recolourBlock(World world, int x, int y, int z, ForgeDirection side, int colour)
|
||||||
|
{
|
||||||
|
int meta = world.getBlockMetadata(x, y, z);
|
||||||
|
if (meta != (15 - colour))
|
||||||
|
{
|
||||||
|
world.setBlockMetadataWithNotify(x, y, z, 15-colour, 3);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue