Work on basic block multi-id-meta stuff

This commit is contained in:
Aidan C. Brady 2014-01-17 07:33:34 -05:00
parent af1ab186d9
commit 95a3084897

View file

@ -49,22 +49,23 @@ import cpw.mods.fml.relauncher.SideOnly;
/**
* Block class for handling multiple metal block IDs.
* 0: Osmium Block
* 1: Bronze Block
* 2: Refined Obsidian
* 3: Charcoal Block
* 4: Refined Glowstone
* 5: Steel Block
* 6: Bin
* 7: Teleporter Frame
* 8: Steel Casing
* 9: Dynamic Tank
* 10: Dynamic Glass
* 11: Dynamic Valve
* 12: Copper Block
* 13: Tin Block
* 14: Salination Controller
* 15: Salination Valve
* 0:0: Osmium Block
* 0:1: Bronze Block
* 0:2: Refined Obsidian
* 0:3: Charcoal Block
* 0:4: Refined Glowstone
* 0:5: Steel Block
* 0:6: Bin
* 0:7: Teleporter Frame
* 0:8: Steel Casing
* 0:9: Dynamic Tank
* 0:10: Dynamic Glass
* 0:11: Dynamic Valve
* 0:12: Copper Block
* 0:13: Tin Block
* 0:14: Salination Controller
* 0:15: Salination Valve
* 1:0: Salination Block
* @author AidanBrady
*
*/
@ -104,6 +105,8 @@ public class BlockBasic extends Block
@Override
@SideOnly(Side.CLIENT)
public void registerIcons(IconRegister register)
{
if(blockID == Mekanism.basicBlockID)
{
icons[0][0] = register.registerIcon("mekanism:OsmiumBlock");
icons[1][0] = register.registerIcon("mekanism:BronzeBlock");
@ -129,6 +132,11 @@ public class BlockBasic extends Block
glassRenderer.registerIcons(register);
}
else if(blockID == Mekanism.basicBlock2ID)
{
}
}
@Override
@SideOnly(Side.CLIENT)
@ -136,6 +144,8 @@ public class BlockBasic extends Block
{
int metadata = world.getBlockMetadata(x, y, z);
if(blockID == Mekanism.basicBlockID)
{
if(metadata == 6)
{
TileEntityBasicBlock tileEntity = (TileEntityBasicBlock)world.getBlockTileEntity(x, y, z);
@ -172,10 +182,17 @@ public class BlockBasic extends Block
return getIcon(side, metadata);
}
}
else if(blockID == Mekanism.basicBlock2ID)
{
}
}
@Override
@SideOnly(Side.CLIENT)
public Icon getIcon(int side, int meta)
{
if(blockID == Mekanism.basicBlockID)
{
if(meta != 6 && meta != 14)
{
@ -205,6 +222,11 @@ public class BlockBasic extends Block
return icons[12][0];
}
}
}
else if(blockID == Mekanism.basicBlock2ID)
{
}
return null;
}
@ -218,6 +240,8 @@ public class BlockBasic extends Block
@Override
@SideOnly(Side.CLIENT)
public void getSubBlocks(int i, CreativeTabs creativetabs, List list)
{
if(blockID == Mekanism.basicBlockID)
{
list.add(new ItemStack(i, 1, 0));
list.add(new ItemStack(i, 1, 1));
@ -236,12 +260,15 @@ public class BlockBasic extends Block
list.add(new ItemStack(i, 1, 14));
list.add(new ItemStack(i, 1, 15));
}
}
@Override
public boolean canCreatureSpawn(EnumCreatureType type, World world, int x, int y, int z)
{
int meta = world.getBlockMetadata(x, y, z);
if(blockID == Mekanism.basicBlockID)
{
if(meta == 9 || meta == 10 || meta == 11)
{
TileEntityDynamicTank tileEntity = (TileEntityDynamicTank)world.getBlockTileEntity(x, y, z);
@ -263,6 +290,7 @@ public class BlockBasic extends Block
}
}
}
}
return super.canCreatureSpawn(type, world, x, y, z);
}
@ -298,6 +326,8 @@ public class BlockBasic extends Block
{
int metadata = world.getBlockMetadata(x, y, z);
if(blockID == Mekanism.basicBlockID)
{
if(metadata != 6)
{
if(ItemAttacher.canAttach(entityplayer.getCurrentEquippedItem()))
@ -386,6 +416,7 @@ public class BlockBasic extends Block
return true;
}
}
}
return false;
}
@ -393,7 +424,7 @@ public class BlockBasic extends Block
@Override
public boolean isBlockSolidOnSide(World world, int x, int y, int z, ForgeDirection side)
{
return world.getBlockMetadata(x, y, z) != 10;
return !(blockID == Mekanism.basicBlockID && world.getBlockMetadata(x, y, z) == 10);
}
private boolean manageInventory(EntityPlayer player, TileEntityDynamicTank tileEntity)
@ -560,6 +591,8 @@ public class BlockBasic extends Block
}
}
if(blockID == Mekanism.basicBlockID)
{
switch(metadata)
{
case 2:
@ -569,18 +602,26 @@ public class BlockBasic extends Block
case 7:
return 12;
}
}
return 0;
}
@Override
public boolean hasTileEntity(int metadata)
{
if(blockID == Mekanism.basicBlockID)
{
return metadata == 6 || metadata == 9 || metadata == 10 || metadata == 11 || metadata == 12 || metadata == 14 || metadata == 15;
}
return false;
}
@Override
public TileEntity createTileEntity(World world, int metadata)
{
if(blockID == Mekanism.basicBlockID)
{
switch(metadata)
{
@ -599,6 +640,7 @@ public class BlockBasic extends Block
case 15:
return new TileEntitySalinationValve();
}
}
return null;
}
@ -664,6 +706,8 @@ public class BlockBasic extends Block
{
ItemStack ret = new ItemStack(blockID, 1, world.getBlockMetadata(x, y, z));
if(blockID == Mekanism.basicBlockID)
{
if(ret.getItemDamage() == 6)
{
TileEntityBin tileEntity = (TileEntityBin)world.getBlockTileEntity(x, y, z);
@ -676,6 +720,7 @@ public class BlockBasic extends Block
inv.setItemType(tileEntity.itemType);
}
}
}
return ret;
}
@ -731,7 +776,7 @@ public class BlockBasic extends Block
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side)
{
if(world.getBlockMetadata(x, y, z) == 10)
if(blockID == Mekanism.basicBlockID && world.getBlockMetadata(x, y, z) == 10)
{
return glassRenderer.shouldRenderSide(world, x, y, z, side);
}