2015-04-22 21:04:40 -04:00
|
|
|
package com.cricketcraft.chisel.client.render;
|
|
|
|
|
|
2015-06-30 01:53:28 -07:00
|
|
|
import com.cricketcraft.chisel.Chisel;
|
2015-04-22 21:04:40 -04:00
|
|
|
import net.minecraft.block.Block;
|
|
|
|
|
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
|
|
|
import net.minecraft.util.IIcon;
|
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
|
|
|
|
|
|
|
|
|
import com.cricketcraft.chisel.init.ChiselBlocks;
|
2015-06-03 17:43:03 -04:00
|
|
|
import com.cricketcraft.ctmlib.CTM;
|
|
|
|
|
import com.cricketcraft.ctmlib.TextureSubmap;
|
|
|
|
|
|
|
|
|
|
import static com.cricketcraft.ctmlib.Dir.*;
|
2015-04-22 21:04:40 -04:00
|
|
|
|
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 SubmapManagerFakeController extends SubmapManagerBase {
|
2015-04-22 21:04:40 -04:00
|
|
|
|
|
|
|
|
private TextureSubmap map;
|
|
|
|
|
private CTM ctm = CTM.getInstance();
|
2015-06-21 22:28:46 -04:00
|
|
|
private int meta;
|
2015-04-22 21:04:40 -04:00
|
|
|
|
2015-06-21 22:28:46 -04:00
|
|
|
public SubmapManagerFakeController(int meta) {
|
2015-04-22 21:04:40 -04:00
|
|
|
ctm.disableObscuredFaceCheck = true;
|
2015-06-21 22:28:46 -04:00
|
|
|
this.meta = meta;
|
2015-04-22 21:04:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@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
|
2015-06-30 01:53:28 -07:00
|
|
|
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side)
|
|
|
|
|
{
|
2015-06-21 22:28:46 -04:00
|
|
|
ctm.buildConnectionMap(world, x, y, z, side, ChiselBlocks.futura, meta);
|
2015-06-30 01:53:28 -07:00
|
|
|
|
|
|
|
|
if (ctm.connectedAnd(TOP, TOP_RIGHT, RIGHT, BOTTOM_RIGHT, BOTTOM, BOTTOM_LEFT, LEFT, TOP_LEFT)) {
|
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) {
|
2015-06-30 01:53:28 -07:00
|
|
|
|
|
|
|
|
switch(meta)
|
|
|
|
|
{
|
|
|
|
|
default:
|
|
|
|
|
Chisel.logger.info("SubmapManagerFakeController was called on block" + block.getUnlocalizedName()
|
|
|
|
|
+ " but an entry was not provided in this class!");
|
|
|
|
|
case 2:
|
|
|
|
|
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controller"), 2, 2);
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
|
|
|
|
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/controllerPurple"), 2, 2);
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
|
|
|
|
map = new TextureSubmap(register.registerIcon(modName + ":futura/WIP/uberWavy"), 2, 2);
|
|
|
|
|
break;
|
|
|
|
|
}
|
2015-04-22 21:04:40 -04:00
|
|
|
}
|
|
|
|
|
}
|