2015-08-18 20:40:55 -04:00
|
|
|
package team.chisel.client.render;
|
2015-04-24 03:38:37 -04:00
|
|
|
|
2015-08-25 22:06:38 -04:00
|
|
|
import team.chisel.ctmlib.RenderBlocksCTM;
|
|
|
|
|
import team.chisel.ctmlib.TextureSubmap;
|
2015-04-24 03:38:37 -04:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
2015-04-26 21:46:18 -04:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
|
|
2015-05-13 13:19:24 -04:00
|
|
|
public class SubmapManagerCarpetFloor extends SubmapManagerBase {
|
2015-04-24 03:38:37 -04:00
|
|
|
|
2015-04-26 21:46:18 -04:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-04-26 22:04:05 -04:00
|
|
|
private static RenderBlocksCTM rb;
|
2015-04-26 02:30:39 -04:00
|
|
|
|
2015-04-24 03:38:37 -04:00
|
|
|
private TextureSubmap submap;
|
|
|
|
|
private TextureSubmap submapSmall;
|
|
|
|
|
private String color;
|
2015-04-26 02:30:39 -04:00
|
|
|
|
2015-04-24 03:38:37 -04:00
|
|
|
public SubmapManagerCarpetFloor(String color) {
|
|
|
|
|
this.color = color;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IIcon getIcon(int side, int meta) {
|
|
|
|
|
return submapSmall.getBaseIcon();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
|
|
|
|
return getIcon(side, world.getBlockMetadata(x, y, z));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2015-04-26 21:46:18 -04:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-04-24 03:38:37 -04:00
|
|
|
public void registerIcons(String modName, Block block, IIconRegister register) {
|
|
|
|
|
String path = modName + ":carpet/" + color;
|
|
|
|
|
submap = new TextureSubmap(register.registerIcon(path + "-ctm"), 4, 4);
|
|
|
|
|
submapSmall = new TextureSubmap(register.registerIcon(path), 2, 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2015-04-26 21:46:18 -04:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-05-13 13:19:24 -04:00
|
|
|
public RenderBlocks createRenderContext(RenderBlocks rendererOld, Block block, IBlockAccess world) {
|
2015-04-26 22:04:05 -04:00
|
|
|
if (rb == null) {
|
|
|
|
|
rb = new RenderBlocksCTM();
|
|
|
|
|
}
|
2015-05-09 20:07:28 -04:00
|
|
|
rb.setRenderBoundsFromBlock(block);
|
2015-04-24 03:38:37 -04:00
|
|
|
rb.submap = submap;
|
|
|
|
|
rb.submapSmall = submapSmall;
|
|
|
|
|
return rb;
|
|
|
|
|
}
|
|
|
|
|
}
|