Added charger to registry, finished block bounds for charger

This commit is contained in:
DarkGuardsman 2014-02-02 15:13:18 -05:00
parent 67fbfd239b
commit dc21d12c76
3 changed files with 85 additions and 2 deletions

View file

@ -18,6 +18,8 @@ import resonantinduction.core.TabRI;
import resonantinduction.electrical.battery.BlockBattery;
import resonantinduction.electrical.battery.ItemBlockBattery;
import resonantinduction.electrical.battery.TileBattery;
import resonantinduction.electrical.charger.BlockCharger;
import resonantinduction.electrical.charger.TileCharger;
import resonantinduction.electrical.encoder.ItemDisk;
import resonantinduction.electrical.generator.BlockGenerator;
import resonantinduction.electrical.generator.TileGenerator;
@ -89,6 +91,7 @@ public class Electrical
public static Block blockThermopile;
// Machines
public static Block blockItemCharger;
// Transport
public static Block blockEMLevitator;
@ -119,6 +122,8 @@ public class Electrical
blockSolarPanel = contentRegistry.createTile(BlockSolarPanel.class, TileSolarPanel.class);
blockGenerator = contentRegistry.createTile(BlockGenerator.class, TileGenerator.class);
blockThermopile = contentRegistry.createTile(BlockThermopile.class, TileThermopile.class);
blockItemCharger = contentRegistry.createTile(BlockCharger.class, TileCharger.class);
Settings.save();

View file

@ -1,7 +1,10 @@
package resonantinduction.electrical.charger;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import resonantinduction.core.Reference;
import resonantinduction.core.prefab.block.BlockRI;
/** Block that is used to charge an item on its surface
@ -12,6 +15,69 @@ public class BlockCharger extends BlockRI
public BlockCharger()
{
super("BlockItemCharger");
setTextureName(Reference.PREFIX + "material_metal_side");
}
@Override
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta)
{
world.setBlockMetadataWithNotify(x, y, z, side, 3);
return side;
}
@Override
public void setBlockBoundsForItemRender()
{
this.setBlockBounds(.6f, 0f, 0f, 1f, 1f, 1f);
}
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileCharger)
{
switch (((TileCharger) tile).getDirection())
{
case DOWN:
this.setBlockBounds(0f, .6f, 0f, 1f, 1f, 1f);
break;
case WEST:
this.setBlockBounds(.6f, 0f, 0f, 1f, 1f, 1f);
break;
case SOUTH:
this.setBlockBounds(0f, 0f, 0f, 1f, 1f, .4f);
break;
case NORTH:
this.setBlockBounds(0f, 0f, .6f, 1f, 1f, 1f);
break;
case UP:
this.setBlockBounds(0f, 0f, 0f, 1f, .4f, 1f);
break;
case EAST:
this.setBlockBounds(0f, 0f, 0f, .4f, 1f, 1f);
break;
default:
break;
}
}
}
@Override
public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ)
{
if (player != null)
{
if (player.inventory.getCurrentItem() != null)
{
}
else
{
}
}
return false;
}
@Override
@ -20,4 +86,16 @@ public class BlockCharger extends BlockRI
return new TileCharger();
}
@Override
public boolean isOpaqueCube()
{
return false;
}
@Override
public int damageDropped(int par1)
{
return 0;
}
}

View file

@ -14,9 +14,9 @@ public class TileCharger extends TileExternalInventory implements IRotatable, IE
{
private long energyCap = 0;
private long energyStored = 0;
private ChargerMode currentMode = ChargerMode.SINGLE;
public ChargerMode currentMode = ChargerMode.SINGLE;
private static enum ChargerMode
public static enum ChargerMode
{
SINGLE(1),
DUAL(2),