2015-08-18 20:40:55 -04:00
|
|
|
package team.chisel.block;
|
2014-12-15 00:11:48 +00:00
|
|
|
|
2015-08-18 20:40:55 -04:00
|
|
|
import team.chisel.Chisel;
|
|
|
|
|
import team.chisel.config.Configurations;
|
2014-04-21 19:13:15 +01:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.block.material.Material;
|
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
|
import net.minecraft.init.Blocks;
|
|
|
|
|
import net.minecraft.util.AxisAlignedBB;
|
|
|
|
|
import net.minecraft.util.IIcon;
|
2015-01-11 19:32:46 -05:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2014-04-21 19:13:15 +01:00
|
|
|
import net.minecraft.world.World;
|
2015-01-11 19:32:46 -05:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
2015-01-11 21:32:37 +00:00
|
|
|
public class BlockRoadLine extends BlockCarvable {
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-11 21:32:37 +00:00
|
|
|
public IIcon aloneIcon[] = new IIcon[4];
|
|
|
|
|
public IIcon halfLineIcon[] = new IIcon[4];
|
|
|
|
|
public IIcon fullLineIcon[] = new IIcon[4];
|
2015-01-07 19:50:18 -05:00
|
|
|
|
2015-01-11 21:32:37 +00:00
|
|
|
public BlockRoadLine() {
|
2015-01-07 19:50:18 -05:00
|
|
|
super(Material.circuits);
|
|
|
|
|
|
2015-01-11 11:45:00 -08:00
|
|
|
if (Configurations.useRoadLineTool) {
|
2015-01-11 19:32:46 -05:00
|
|
|
this.setHarvestLevel(Configurations.getRoadLineTool, Configurations.roadLineToolLevel);
|
2015-01-11 11:45:00 -08:00
|
|
|
}
|
2015-01-07 19:50:18 -05:00
|
|
|
this.setBlockBounds(0.0f, 0.0f, 0.0f, 1.0f, 0.00390625f, 1.0f);
|
|
|
|
|
// this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.0625F, 1.0F);
|
|
|
|
|
}
|
2015-01-11 19:32:46 -05:00
|
|
|
|
2015-01-07 19:50:18 -05:00
|
|
|
@Override
|
|
|
|
|
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean isOpaqueCube() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean renderAsNormalBlock() {
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int getRenderType() {
|
2015-01-11 21:32:37 +00:00
|
|
|
return Chisel.roadLineId;
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
|
|
|
|
return World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || par1World.getBlock(par2, par3 - 1, par4).equals(Blocks.glowstone);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block block) {
|
|
|
|
|
if (par1World.isRemote)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (!this.canPlaceBlockAt(par1World, par2, par3, par4)) {
|
|
|
|
|
this.dropBlockAsItem(par1World, par2, par3, par4, 0, 0);
|
|
|
|
|
par1World.setBlockToAir(par2, par3, par4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
super.onNeighborBlockChange(par1World, par2, par3, par4, block);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2015-01-11 19:32:46 -05:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-01-07 19:50:18 -05:00
|
|
|
public void registerBlockIcons(IIconRegister reg) {
|
2015-01-11 19:32:46 -05:00
|
|
|
for (int i = 0; i < 4; i++) {
|
|
|
|
|
String[] texNames = { "white", "yellow", "double-white", "double-yellow" };
|
2015-01-11 21:32:37 +00:00
|
|
|
aloneIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-center");
|
|
|
|
|
halfLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-side");
|
|
|
|
|
fullLineIcon[i] = reg.registerIcon("Chisel:line-marking/" + texNames[i] + "-long");
|
|
|
|
|
}
|
2015-01-07 19:50:18 -05:00
|
|
|
}
|
2014-04-21 19:13:15 +01:00
|
|
|
|
2015-01-11 19:32:46 -05:00
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public IIcon getIcon(int side, int metadata) {
|
|
|
|
|
return aloneIcon[metadata % aloneIcon.length];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
|
|
|
|
return getIcon(side, world.getBlockMetadata(x, y, z));
|
|
|
|
|
}
|
2014-04-21 19:13:15 +01:00
|
|
|
}
|