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