Re-add Debug blocks

This commit is contained in:
DarkGuardsman 2014-01-19 22:13:51 -05:00
parent 0e901070d7
commit c1f8082fe4
6 changed files with 121 additions and 137 deletions

View file

@ -23,161 +23,140 @@ import cpw.mods.fml.relauncher.SideOnly;
public class BlockDebug extends BlockRI implements IBlockInfo public class BlockDebug extends BlockRI implements IBlockInfo
{ {
public static float DebugWattOut, DebugWattDemand; public static float DebugWattOut, DebugWattDemand;
public BlockDebug() public BlockDebug()
{ {
super("DebugBlock"); super("DebugBlock");
this.setCreativeTab(ResonantInductionTabs.CORE); }
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public void registerIcons(IconRegister iconReg) public void registerIcons(IconRegister iconReg)
{ {
super.registerIcons(iconReg); super.registerIcons(iconReg);
for (DebugBlocks block : DebugBlocks.values()) for (DebugBlocks block : DebugBlocks.values())
{ {
if (block.enabled) block.icon = iconReg.registerIcon(Reference.PREFIX + block.getTextureName());
{ }
block.icon = iconReg.registerIcon(Reference.PREFIX + block.getTextureName()); }
}
}
}
@Override @Override
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta) public Icon getIcon(int side, int meta)
{ {
if (meta < DebugBlocks.values().length) if (meta < DebugBlocks.values().length)
{ {
return DebugBlocks.values()[meta].icon; return DebugBlocks.values()[meta].icon;
} }
return this.blockIcon; return this.blockIcon;
} }
@Override @Override
public TileEntity createTileEntity(World world, int metadata) public TileEntity createTileEntity(World world, int metadata)
{ {
if (metadata < DebugBlocks.values().length) if (metadata < DebugBlocks.values().length)
{ {
try try
{ {
return DebugBlocks.values()[metadata].clazz.newInstance(); return DebugBlocks.values()[metadata].clazz.newInstance();
} }
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
} }
} }
return super.createTileEntity(world, metadata); return super.createTileEntity(world, metadata);
} }
@Override @Override
public TileEntity createNewTileEntity(World world) public TileEntity createNewTileEntity(World world)
{ {
return null; return null;
} }
@Override @Override
public void onBlockAdded(World world, int x, int y, int z) public void getSubBlocks(int blockID, CreativeTabs tab, List creativeTabList)
{ {
super.onBlockAdded(world, x, y, z); for (DebugBlocks block : DebugBlocks.values())
int meta = world.getBlockMetadata(x, y, z); {
if (meta >= DebugBlocks.values().length || !DebugBlocks.values()[meta].enabled) creativeTabList.add(new ItemStack(blockID, 1, block.ordinal()));
{ }
world.setBlock(x, y, z, 0); }
}
}
@Override @Override
public void getSubBlocks(int blockID, CreativeTabs tab, List creativeTabList) public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list)
{ {
for (DebugBlocks block : DebugBlocks.values()) for (DebugBlocks block : DebugBlocks.values())
{ {
if (block.enabled) list.add(new Pair<String, Class<? extends TileEntity>>(block.name, block.clazz));
{
creativeTabList.add(new ItemStack(blockID, 1, block.ordinal()));
}
}
}
@Override }
public void getTileEntities(int blockID, Set<Pair<String, Class<? extends TileEntity>>> list) }
{
for (DebugBlocks block : DebugBlocks.values())
{
if (block.enabled && block.clazz != null && block.name != null)
{
list.add(new Pair<String, Class<? extends TileEntity>>(block.name, block.clazz));
}
}
}
@Override @Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{ {
return false; return false;
} }
@Override @Override
public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{ {
return false; return false;
} }
@Override @Override
public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) public boolean onUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{ {
return false; return false;
} }
@Override @Override
public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) public boolean onSneakUseWrench(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ)
{ {
return this.onUseWrench(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ); return this.onUseWrench(world, x, y, z, entityPlayer, side, hitX, hitY, hitZ);
} }
public static enum DebugBlocks public static enum DebugBlocks
{ {
SOURCE("UnlimitedPower", TileEntityInfSupply.class, "infSource"), SOURCE("UnlimitedPower", TileEntityInfSupply.class, "infSource"),
FLUID("UnlimitedFluid", TileEntityInfFluid.class, "infFluid"), FLUID("UnlimitedFluid", TileEntityInfFluid.class, "infFluid"),
VOID("FluidVoid", TileEntityVoid.class, "void"), VOID("FluidVoid", TileEntityVoid.class, "void"),
LOAD("PowerVampire", TileEntityInfLoad.class, "infLoad"); LOAD("PowerVampire", TileEntityInfLoad.class, "infLoad");
public Icon icon; public Icon icon;
public String name; public String name;
public String texture; public String texture;
public boolean enabled; Class<? extends TileEntity> clazz;
Class<? extends TileEntity> clazz;
private DebugBlocks(String name, Class<? extends TileEntity> clazz) private DebugBlocks(String name, Class<? extends TileEntity> clazz)
{ {
this.name = name; this.name = name;
this.clazz = clazz; this.clazz = clazz;
} }
private DebugBlocks(String name, Class<? extends TileEntity> clazz, String texture) private DebugBlocks(String name, Class<? extends TileEntity> clazz, String texture)
{ {
this(name, clazz); this(name, clazz);
this.texture = texture; this.texture = texture;
} }
public String getTextureName() public String getTextureName()
{ {
if (texture == null || texture.isEmpty()) if (texture == null || texture.isEmpty())
{ {
return name; return name;
} }
return texture; return texture;
} }
} }
@Override @Override
public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list) public void getClientTileEntityRenderers(List<Pair<Class<? extends TileEntity>, TileEntitySpecialRenderer>> list)
{ {
// TODO Auto-generated method stub // TODO Auto-generated method stub
} }
} }

View file

@ -16,6 +16,11 @@ item.resonantinduction\:oreDust.name=%v Dust
item.resonantinduction\:oreRefinedDust.name=%v Refined Dust item.resonantinduction\:oreRefinedDust.name=%v Refined Dust
item.resonantinduction\:oreRubble.name=%v Rubble item.resonantinduction\:oreRubble.name=%v Rubble
tile.resonantinduction\:DebugBlock.0.name=Infinite Power
tile.resonantinduction\:DebugBlock.1.name=Infinite Fluid
tile.resonantinduction\:DebugBlock.2.name=Fluid Void
tile.resonantinduction\:DebugBlock.3.name=Power Void
### Archaic Module ### Archaic Module
## Items ## Items
item.resonantinduction\:imprint.name=Imprint item.resonantinduction\:imprint.name=Imprint

Binary file not shown.

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 227 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 226 B