2015-04-22 21:04:40 -04:00
|
|
|
package com.cricketcraft.chisel.client.render;
|
|
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
2015-04-24 03:38:37 -04:00
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
2015-04-22 21:04:40 -04:00
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
|
|
2015-04-24 03:38:37 -04:00
|
|
|
import com.cricketcraft.chisel.api.rendering.CTM;
|
|
|
|
|
import com.cricketcraft.chisel.api.rendering.TextureSubmap;
|
2015-04-22 21:04:40 -04:00
|
|
|
import com.cricketcraft.chisel.init.ChiselBlocks;
|
|
|
|
|
|
2015-04-26 21:46:18 -04:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2015-04-24 03:38:37 -04:00
|
|
|
import static com.cricketcraft.chisel.api.rendering.Dir.*;
|
2015-04-22 21:04:40 -04:00
|
|
|
|
2015-04-26 02:30:39 -04:00
|
|
|
public class SubmapManagerFakeController extends SubmapManagerBase<RenderBlocks> {
|
2015-04-22 21:04:40 -04:00
|
|
|
|
|
|
|
|
private TextureSubmap map;
|
|
|
|
|
private CTM ctm = CTM.getInstance();
|
|
|
|
|
|
|
|
|
|
public SubmapManagerFakeController() {
|
|
|
|
|
ctm.disableObscuredFaceCheck = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IIcon getIcon(int side, int meta) {
|
2015-04-23 17:31:25 -04:00
|
|
|
return map.getSubIcon(0, 0);
|
2015-04-22 21:04:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
|
|
|
|
ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, 2);
|
|
|
|
|
if (ctm.connectedAnd(TOP, BOTTOM, LEFT, RIGHT)) {
|
2015-04-23 17:31:25 -04:00
|
|
|
return map.getSubIcon(1, 1);
|
2015-04-22 21:04:40 -04:00
|
|
|
} else if (ctm.connectedAnd(TOP, BOTTOM)) {
|
2015-04-23 17:31:25 -04:00
|
|
|
return map.getSubIcon(0, 1);
|
2015-04-22 21:04:40 -04:00
|
|
|
} else if (ctm.connectedAnd(LEFT, RIGHT)) {
|
2015-04-23 17:31:25 -04:00
|
|
|
return map.getSubIcon(1, 0);
|
2015-04-22 21:04:40 -04:00
|
|
|
} else {
|
2015-04-23 17:31:25 -04:00
|
|
|
return map.getSubIcon(0, 0);
|
2015-04-22 21:04:40 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
2015-04-26 21:46:18 -04:00
|
|
|
@SideOnly(Side.CLIENT)
|
2015-04-22 21:04:40 -04:00
|
|
|
public void registerIcons(String modName, Block block, IIconRegister register) {
|
|
|
|
|
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controllerWIP-ctm"), 2, 2);
|
|
|
|
|
}
|
|
|
|
|
}
|