2016-01-12 17:05:56 -05:00
|
|
|
package WayofTime.bloodmagic.block;
|
|
|
|
|
|
|
|
import net.minecraft.block.state.IBlockState;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.item.ItemStack;
|
2016-01-12 17:05:56 -05:00
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraft.util.EnumFacing;
|
2016-03-18 13:16:38 -04:00
|
|
|
import net.minecraft.util.EnumHand;
|
|
|
|
import net.minecraft.util.math.BlockPos;
|
2016-01-12 17:05:56 -05:00
|
|
|
import net.minecraft.world.World;
|
2016-03-18 13:16:38 -04:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
|
|
|
import WayofTime.bloodmagic.tile.routing.TileInputRoutingNode;
|
2016-01-12 17:05:56 -05:00
|
|
|
|
2016-01-15 21:53:55 -05:00
|
|
|
public class BlockInputRoutingNode extends BlockRoutingNode
|
2016-01-12 17:05:56 -05:00
|
|
|
{
|
|
|
|
public BlockInputRoutingNode()
|
|
|
|
{
|
2016-01-15 21:53:55 -05:00
|
|
|
super();
|
2016-01-12 17:05:56 -05:00
|
|
|
|
|
|
|
setUnlocalizedName(Constants.Mod.MODID + ".inputRouting");
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public TileEntity createNewTileEntity(World worldIn, int meta)
|
|
|
|
{
|
2016-01-16 11:10:58 -05:00
|
|
|
return new TileInputRoutingNode();
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-01-16 11:10:58 -05:00
|
|
|
//TODO: Combine BlockInputRoutingNode and BlockInputRoutingNode so they have the same superclass
|
2016-01-12 17:05:56 -05:00
|
|
|
public void breakBlock(World world, BlockPos pos, IBlockState state)
|
|
|
|
{
|
|
|
|
TileEntity tile = world.getTileEntity(pos);
|
2016-01-16 11:10:58 -05:00
|
|
|
if (tile instanceof TileInputRoutingNode)
|
2016-01-12 17:05:56 -05:00
|
|
|
{
|
2016-01-16 11:10:58 -05:00
|
|
|
((TileInputRoutingNode) tile).removeAllConnections();
|
|
|
|
((TileInputRoutingNode) tile).dropItems();
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
|
|
|
super.breakBlock(world, pos, state);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2016-03-18 13:16:38 -04:00
|
|
|
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ)
|
2016-01-12 17:05:56 -05:00
|
|
|
{
|
2016-01-16 11:10:58 -05:00
|
|
|
if (world.getTileEntity(pos) instanceof TileInputRoutingNode)
|
2016-01-12 17:05:56 -05:00
|
|
|
{
|
2016-01-14 11:06:50 -05:00
|
|
|
player.openGui(BloodMagic.instance, Constants.Gui.ROUTING_NODE_GUI, world, pos.getX(), pos.getY(), pos.getZ());
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
|
|
|
|
2016-01-14 11:06:50 -05:00
|
|
|
return true;
|
2016-01-12 17:05:56 -05:00
|
|
|
}
|
|
|
|
}
|